Elin Decompiled Documentation EA 23.286 Nightly Patch 1
Loading...
Searching...
No Matches
AI_PlayMusic Class Reference
Inheritance diagram for AI_PlayMusic:
AIAct Act Element EClass

Public Member Functions

override IEnumerable< StatusRun ()
 
void Evaluate (bool success)
 
void ThrowReward (Chara c, bool punish)
 
override void OnCancel ()
 
- Public Member Functions inherited from AIAct
override string ToString ()
 
override MultiSprite GetStateIcon ()
 
virtual bool ShouldAllyAttack (Chara tg)
 
virtual Point GetDestination ()
 
AIProgress GetProgress ()
 
string GetCurrentActionText ()
 
override bool IsToolValid ()
 
GetChild< T > ()
 
virtual void OnStart ()
 
void SetOwner (Chara c)
 
virtual void OnSetOwner ()
 
void SetChild (AIAct seq, Func< Status > _onChildFail=null)
 
void Start ()
 
override bool Perform ()
 
Status Restart ()
 
Status Success (Action action=null)
 
virtual void OnSuccess ()
 
bool TryCancel (Card c)
 
virtual Status Cancel ()
 
virtual void OnCancel ()
 
virtual void OnCancelOrSuccess ()
 
virtual bool CanManualCancel ()
 
Status KeepRunning ()
 
void Reset ()
 
virtual void OnReset ()
 
Status Tick ()
 
virtual IEnumerable< StatusRun ()
 
Status TickChild ()
 
Status Do (AIAct _seq, Func< Status > _onChildFail=null)
 
Status DoGotoInteraction (Point pos, Func< Status > _onChildFail=null)
 
Status DoGoto (Point pos, int dist=0, bool ignoreConnection=false, Func< Status > _onChildFail=null)
 
Status DoGoto (Card card, Func< Status > _onChildFail=null)
 
Status DoGoto (Card card, int dist, Func< Status > _onChildFail=null)
 
Status DoGotoSpot (Card card, Func< Status > _onChildFail=null)
 
Status DoGoto< T > (Func< Status > _onChildFail=null)
 
Status DoGotoSpot< T > (Func< Status > _onChildFail=null, bool ignoreAccessType=false)
 
Status DoGrab (Card card, int num=-1, bool pickHeld=false, Func< Status > _onChildFail=null)
 
Status DoGrab< T > ()
 
Status DoProgress ()
 
Status DoIdle (int repeat=3)
 
Status DoWait (int count=1)
 
virtual AIProgress CreateProgress ()
 
virtual void OnCreateProgress (Progress_Custom p)
 
virtual bool CanProgress ()
 
virtual void OnBeforeProgress ()
 
virtual void OnProgress ()
 
virtual void OnProgressComplete ()
 
void SimulateZone (int days)
 
virtual void OnSimulateZone (int days)
 
virtual void OnSimulatePosition ()
 
- Public Member Functions inherited from Act
virtual CursorInfo GetCursorIcon (Card c)
 
virtual MultiSprite GetStateIcon ()
 
override Sprite GetSprite ()
 
virtual bool ShowMouseHint (Card c)
 
virtual bool IsValidTC (Card c)
 
virtual string GetHintText (string str="")
 
virtual string GetText (string str="")
 
virtual string GetTextSmall (Card c)
 
bool IsTargetHostileParty ()
 
virtual Color GetActPlanColor ()
 
virtual bool Perform ()
 
bool Perform (Chara _cc, Card _tc=null, Point _tp=null)
 
virtual bool ValidatePerform (Chara _cc, Card _tc, Point _tp)
 
virtual bool CanPerform ()
 
bool CanPerform (Chara _cc, Card _tc=null, Point _tp=null)
 
virtual bool IsToolValid ()
 
new void SetImage (Image image)
 
virtual void OnMarkMapHighlights ()
 
virtual bool ShouldMapHighlight (Point p)
 
- Public Member Functions inherited from Element
virtual SourceElement.Row GetSource ()
 
virtual int GetSourcePotential (int v)
 
virtual Sprite GetSprite ()
 
int GetMaterialSourceValue (Thing t, int v)
 
virtual long GetSourceValue (long v, int lv, SourceValueType type)
 
virtual Sprite GetIcon (string suffix="")
 
bool IsActive (Card c)
 
int SortVal (bool charaSheet=false)
 
virtual bool CanLink (ElementContainer owner)
 
bool HasTag (string tag)
 
void SetImage (Image i)
 
virtual string GetDetail ()
 
bool IsFactionElement (Chara c)
 
Element GetParent (Card c)
 
void WriteNote (UINote n, ElementContainer owner=null, Action< UINote > onWriteNote=null)
 
void WriteNoteWithRef (UINote n, ElementContainer owner, Action< UINote > onWriteNote, Element refEle)
 
void _WriteNote (UINote n, Chara c, Act act)
 
void AddHeaderAbility (UINote n)
 
void _WriteNote (UINote n, ElementContainer owner, Action< UINote > onWriteNote, bool isRef, bool addHeader=true)
 
void AddEncNote (UINote n, Card Card, ElementContainer.NoteMode mode=ElementContainer.NoteMode.Default, Func< Element, string, string > funcText=null, Action< UINote, Element > onAddNote=null)
 
virtual void OnWriteNote (UINote n, ElementContainer owner)
 
virtual void OnChangeValue ()
 
void CheckLevelBonus (ElementContainer owner, UINote n=null)
 
int GetSortVal (UIList.SortMode m)
 
virtual Act.Cost GetCost (Chara c)
 
virtual int GetPower (Card c)
 
virtual void SetTextValue (UIText text, bool shorten=false)
 
virtual bool IsPurchaseFeatReqMet (ElementContainer owner, int lv=-1)
 
virtual void WritePurchaseReq (UINote n, int lv=1)
 

Static Public Member Functions

static void CancelKeepPlaying ()
 
- Static Public Member Functions inherited from Act
static void SetReference (Chara _cc, Card _tc=null, Point _tp=null)
 
static void SetTool (Thing t)
 
- Static Public Member Functions inherited from Element
static string GetName (string alias)
 
static SourceElement.Row Get (int id)
 
static Dictionary< int, int > GetElementMap (int[] list)
 
static Dictionary< int, int > GetElementMap (int[] list, Dictionary< int, int > map)
 
static SourceElement.Row GetRandomElement (int lv=1, bool useWeight=true)
 
static Element Create (int id, int v=0)
 
static Element Create (string id, int v=1)
 
static int GetId (string alias)
 
static int GetResistLv (int v)
 
static long GetResistDamage (long dmg, int v, int power=0)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Public Attributes

Thing tool
 
PlayingSong playing
 
int score
 
int gold
 
int toolLv
 
- Public Attributes inherited from AIAct
new Chara owner
 
Status status
 
IEnumerator< StatusEnumerator
 
AIAct child
 
AIAct parent
 
byte restartCount
 
Func< StatusonChildFail
 
Func< bool > isFail
 
- Public Attributes inherited from Element
SourceElement.Row _source
 
int id
 
int vBase
 
int vExp
 
int vPotential
 
int vTempPotential
 
int vLink
 
int vSource
 
int vSourcePotential
 
ElementContainer owner
 

Static Public Attributes

static bool keepPlaying
 
static Thing playingTool
 
static bool ignoreDamage
 
- Static Public Attributes inherited from Act
static Chara CC
 
static Card TC
 
static Point TP = new Point()
 
static Thing TOOL
 
static int powerMod = 100
 
static bool forcePt
 
static Act CurrentAct
 
- Static Public Attributes inherited from Element
const int Div = 5
 
static Element Void = new Element()
 
static int[] List_MainAttributes = new int[9] { 70, 72, 71, 77, 74, 75, 76, 73, 79 }
 
static int[] List_MainAttributesMajor = new int[8] { 70, 72, 71, 77, 74, 75, 76, 73 }
 
static int[] List_Body = new int[4] { 70, 72, 71, 77 }
 
static int[] List_Mind = new int[4] { 74, 75, 76, 73 }
 
static List< SourceElement.RowListElements = new List<SourceElement.Row>()
 
static List< SourceElement.RowListAttackElements = new List<SourceElement.Row>()
 
- Static Public Attributes inherited from EClass
static Core core
 

Properties

override bool ShowProgress [get]
 
override bool CancelWhenDamaged [get]
 
override TargetType TargetType [get]
 
- Properties inherited from AIAct
virtual bool IsRunning [get]
 
bool IsChildRunning [get]
 
bool IsMoveAI [get]
 
virtual int MaxRestart [get]
 
virtual new string Name [get]
 
virtual MultiSprite stateIcon [get]
 
virtual Sprite actionIcon [get]
 
virtual bool IsNoGoal [get]
 
virtual bool IsAutoTurn [get]
 
virtual bool IsIdle [get]
 
virtual bool CancelOnAggro [get]
 
virtual bool PushChara [get]
 
virtual int MaxProgress [get]
 
virtual bool ShowProgress [get]
 
virtual bool UseTurbo [get]
 
virtual int CurrentProgress [get]
 
virtual bool ShowCursor [get]
 
virtual bool CancelWhenDamaged [get]
 
virtual bool CancelWhenMoved [get]
 
virtual bool InformCancel [get]
 
virtual Thing RenderThing [get]
 
AIAct Current [get]
 
override bool IsAct [get]
 
override bool ShowPotential [get]
 
override bool UsePotential [get]
 
override bool ShowRelativeAttribute [get]
 
virtual bool HasProgress [get]
 
- Properties inherited from Act
override bool ShowPotential [get]
 
override bool UsePotential [get]
 
override bool ShowRelativeAttribute [get]
 
virtual CursorInfo CursorIcon [get]
 
virtual string ID [get]
 
virtual bool IsAct [get]
 
virtual bool WillEndTurn [get]
 
virtual bool CloseLayers [get]
 
virtual int LeftHand [get]
 
virtual int RightHand [get]
 
virtual int ElementPowerMod [get]
 
virtual bool ShowMapHighlight [get]
 
virtual bool ShowMapHighlightBlock [get]
 
virtual bool PickHeldOnStart [get]
 
virtual bool DropHeldOnStart [get]
 
virtual bool CanPressRepeat [get]
 
virtual bool CanAutofire [get]
 
virtual bool ResetAxis [get]
 
virtual bool RequireTool [get]
 
virtual bool IsHostileAct [get]
 
virtual bool HideRightInfo [get]
 
virtual bool ShouldEndMimicry [get]
 
virtual bool HaveLongPressAction [get]
 
virtual float Radius [get]
 
virtual int PerformDistance [get]
 
virtual int MaxRadius [get]
 
virtual TargetType TargetType [get]
 
virtual bool LocalAct [get]
 
virtual bool CanRapidFire [get]
 
virtual float RapidDelay [get]
 
virtual bool ShowAuto [get]
 
- Properties inherited from Element
SourceElement.Row source [get]
 
virtual int DisplayValue [get]
 
virtual int MinValue [get]
 
int Value [get]
 
int ValueWithoutLink [get]
 
virtual int MinPotential [get]
 
int Potential [get]
 
virtual bool CanGainExp [get]
 
bool IsFlag [get]
 
virtual string Name [get]
 
virtual string FullName [get]
 
virtual int ExpToNext [get]
 
virtual bool UseExpMod [get]
 
virtual int CostTrain [get]
 
virtual int CostLearn [get]
 
virtual bool ShowXP [get]
 
virtual bool ShowMsgOnValueChanged [get]
 
virtual bool ShowValue [get]
 
virtual bool ShowPotential [get]
 
virtual bool UsePotential [get]
 
virtual bool PotentialAsStock [get]
 
virtual bool ShowRelativeAttribute [get]
 
virtual bool ShowBonuses [get]
 
virtual string ShortName [get]
 
bool IsGlobalElement [get]
 
bool IsFactionWideElement [get]
 
bool IsPartyWideElement [get]
 
virtual bool ShowEncNumber [get]
 
bool IsTrait [get]
 
bool IsFoodTrait [get]
 
bool IsFoodTraitMain [get]
 
bool IsMainAttribute [get]
 
Act act [get]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Additional Inherited Members

- Public Types inherited from AIAct
enum  Status { Running , Fail , Success }
 
- Public Types inherited from Act
enum  CostType { None , MP , SP }
 

Detailed Description

Definition at line 6 of file AI_PlayMusic.cs.

Member Function Documentation

◆ CancelKeepPlaying()

static void AI_PlayMusic.CancelKeepPlaying ( )
inlinestatic

Definition at line 40 of file AI_PlayMusic.cs.

41 {
42 if (keepPlaying)
43 {
44 SE.CancelAction();
45 keepPlaying = false;
46 playingTool = null;
47 }
48 }
static Thing playingTool
Definition: AI_PlayMusic.cs:10
static bool keepPlaying
Definition: AI_PlayMusic.cs:8

References keepPlaying, and playingTool.

Referenced by AM_Adv._OnUpdateInput(), and Scene.OnUpdate().

◆ Evaluate()

void AI_PlayMusic.Evaluate ( bool  success)
inline

Definition at line 429 of file AI_PlayMusic.cs.

430 {
431 if (owner == null || !owner.IsPC)
432 {
433 return;
434 }
435 if (success)
436 {
437 score = score * 110 / 100;
438 }
439 else
440 {
441 score = score / 2 - 20;
442 }
443 int num = Mathf.Clamp(score / 20 + 1, 0, 9);
444 owner.Say(Lang.GetList("music_result")[num]);
445 if (gold > 0)
446 {
447 owner.Say("music_reward", owner, gold.ToString() ?? "");
448 }
449 if (EClass.rnd(3) != 0)
450 {
451 owner.stamina.Mod(-1);
452 }
453 QuestMusic questMusic = EClass.game.quests.Get<QuestMusic>();
454 if (questMusic != null)
455 {
456 questMusic.score += score;
457 questMusic.sumMoney += gold;
458 int num2 = num / 2 - 1;
459 if (num > 0)
460 {
461 SE.Play("clap" + num2);
462 }
463 }
464 }
new Chara owner
Definition: AIAct.cs:14
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:7052
override bool IsPC
Definition: Chara.cs:626
Stats stamina
Definition: Chara.cs:1172
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static int rnd(long a)
Definition: EClass.cs:59
QuestManager quests
Definition: Game.cs:183
Definition: Lang.cs:7
static string[] GetList(string id)
Definition: Lang.cs:117
Quest Get(string id)
virtual void Mod(int a)
Definition: Stats.cs:135

References EClass.game, QuestManager.Get(), Lang.GetList(), Game.quests, and EClass.rnd().

Referenced by Run().

◆ OnCancel()

override void AI_PlayMusic.OnCancel ( )
inlinevirtual

Reimplemented from AIAct.

Definition at line 595 of file AI_PlayMusic.cs.

596 {
597 if (playing != null && (bool)playing.bgm)
598 {
599 playing.bgm.song.Fail(playing.source, playing.bgm);
600 if ((bool)UISong.Instance)
601 {
603 }
604 playing.source = null;
605 SoundManager.jingleTimer = 1f;
606 }
607 Evaluate(success: false);
608 }
void Evaluate(bool success)
PlayingSong playing
Definition: AI_PlayMusic.cs:16
SoundSource source
Definition: PlayingSong.cs:13
BGMData bgm
Definition: PlayingSong.cs:11
Definition: UISong.cs:5
void Kill()
Definition: UISong.cs:69
static UISong Instance
Definition: UISong.cs:6

References PlayingSong.bgm, UISong.Instance, UISong.Kill(), and PlayingSong.source.

◆ Run()

override IEnumerable< Status > AI_PlayMusic.Run ( )
inlinevirtual

Reimplemented from AIAct.

Definition at line 50 of file AI_PlayMusic.cs.

51 {
52 if (tool == null)
53 {
54 tool = (owner.IsPC ? owner.Tool : owner.things.Find<TraitToolMusic>());
55 }
56 if (tool == null && !owner.IsPCFaction && EClass.rnd(20) == 0)
57 {
59 }
60 if (tool == null)
61 {
62 yield return Cancel();
63 }
64 if (tool.parent is Zone)
65 {
66 yield return DoGoto(tool.pos, tool.pos.IsBlocked ? 1 : 0);
67 }
69 {
70 keepPlaying = true;
72 EInput.Consume(consumeAxis: true, 10);
73 }
74 toolLv = 1;
75 string idSong = null;
76 KnownSong song = null;
77 playing = null;
78 score = 40;
79 gold = 0;
81 {
83 idSong = EClass.player.playingSong.id;
85 }
86 if (playing == null)
87 {
88 switch (tool.id)
89 {
90 case "sax":
91 case "trumpet":
92 idSong = "trumpet_practice";
93 break;
94 case "piano_gould":
95 idSong = "piano_gould";
96 break;
97 case "piano_killkill":
98 case "piano2":
99 idSong = "piano_neko";
100 break;
101 case "piano":
102 idSong = "piano_kanon";
103 break;
104 case "harpsichord":
105 idSong = "harpsichord_goldberg";
106 break;
107 case "guitar_ash":
108 idSong = "guitar_caccini";
109 break;
110 case "ocarina":
111 idSong = "ocarina_lulu";
112 break;
113 case "guitar_efrond":
114 idSong = "guitar_dusk";
115 break;
116 case "guitar":
117 idSong = "guitar_air";
118 break;
119 case "harp":
120 idSong = "harp_komori";
121 break;
122 case "shield_lute":
123 case "lute":
124 idSong = "guitar_sad";
125 break;
126 case "recorder":
127 idSong = "recorder";
128 break;
129 case "flute":
130 idSong = "flute";
131 break;
132 case "taiko":
133 case "drum":
134 idSong = "taiko";
135 break;
136 case "mokugyo":
137 idSong = "mokugyo";
138 break;
139 case "tambourine":
140 idSong = "tambourine";
141 break;
142 case "mic":
143 idSong = "mic_rachmaninoff";
144 break;
145 case "cello":
146 idSong = "cello_prelude";
147 break;
148 case "koto":
149 idSong = "koto";
150 break;
151 case "instrument_violin":
152 case "panty":
153 idSong = "violin_chaconne";
154 break;
155 case "stradivarius":
156 idSong = "violin_furusato";
157 break;
158 default:
159 idSong = ((EClass.Sound.GetData("Instrument/" + tool.id) is BGMData) ? tool.id : "violin_chaconne");
160 break;
161 }
162 if (owner.IsPC && EClass.player.knownSongs.ContainsKey(idSong))
163 {
164 song = EClass.player.knownSongs[idSong];
165 }
166 if (song == null)
167 {
168 song = new KnownSong();
169 if (owner.IsPC)
170 {
171 EClass.player.knownSongs[idSong] = song;
172 }
173 }
174 playing = new PlayingSong
175 {
176 id = idSong,
177 idTool = tool.id
178 };
179 if (owner.IsPC)
180 {
181 EClass.player.playingSong = playing;
182 }
183 }
184 if (owner.IsPC && EClass.Sound.GetData("Instrument/" + idSong) is BGMData bGMData)
185 {
186 bGMData.song.index = playing.index;
187 }
188 if (Application.isEditor && owner.IsPC)
189 {
190 song.lv += 10;
191 Debug.Log(song.lv);
192 }
193 List<Chara> reacted = new List<Chara>();
194 Progress_Custom progress = new Progress_Custom
195 {
196 maxProgress = 15,
197 cancelWhenMoved = false,
198 showProgress = false,
199 canProgress = () => tool != null && !tool.isDestroyed,
200 onProgressBegin = delegate
201 {
202 owner.Say("music_start", owner, tool);
203 owner.ShowEmo(Emo.happy, 3f, skipSame: false);
204 if (tool != null && tool.ExistsOnMap)
205 {
207 }
208 owner.PlayAnime(AnimeID.PlayMusic);
209 if (owner.IsPC)
210 {
211 bool flag = false;
212 if (playing.mistakes == 0 && (bool)playing.source && playing.source.isPlaying && playing.source.data.name == idSong)
213 {
214 SoundSource soundSource = playing.source;
215 if (Mathf.Abs(soundSource.source.time - (soundSource.data as BGMData).song.parts[playing.index].start) < 2f && playing.source.source.volume >= 0.1f)
216 {
217 soundSource.KeepPlay();
218 flag = true;
219 Debug.Log("keep:" + soundSource.source.time);
220 }
221 else
222 {
223 EClass.Sound.Stop(soundSource.data, 0.1f);
224 }
225 Debug.Log(playing.source);
226 }
227 if (!flag)
228 {
229 playing.source = owner.PlaySound("Instrument/" + idSong);
230 Debug.Log(playing.source);
231 }
232 playing.bgm = playing.source.data as BGMData;
233 BGMData.Part part = playing.bgm.song.parts[playing.index];
234 if (!UISong.Instance)
235 {
236 Util.Instantiate<UISong>("UI/Util/UISong", EClass.ui.rectDynamicEssential);
237 }
239 if (EClass.Sound.currentBGM != null)
240 {
241 float num3 = 0.5f - 0.1f * (float)playing.index;
242 if (num3 < 0f)
243 {
244 num3 = 0f;
245 }
246 if (EClass.Sound.sourceBGM.volume > EClass.Sound.currentBGM.data.volume * num3)
247 {
248 EClass.Sound.sourceBGM.DOFade(EClass.Sound.currentBGM.data.volume * num3, 3f);
249 }
250 SoundManager.jingleTimer = part.duration / playing.bgm.pitch + playing.bgm.song.fadeIn + 2f;
251 }
252 }
253 },
254 onProgress = delegate(Progress_Custom p)
255 {
257 owner.Say(Lang.GetList("music").RandomItem());
258 Msg.SetColor();
259 if (tool.id == "tambourine")
260 {
261 Msg.Say("tambourine");
262 }
263 if (EClass.debug.enable && EClass.pc.job.id == "pianist")
264 {
265 song.lv = 10000;
266 }
267 if (p.progress > 2 && (EClass.rnd(100 + 50 * owner.Evalue(1405)) == 0 || EClass.rnd(4 + (int)MathF.Max(0f, song.lv - playing.index * 25 - playing.index * playing.index / 2)) == 0))
268 {
270 if (EClass.rnd(2) == 0)
271 {
272 LevelSong(2 + 2 * EClass.rnd(owner.Evalue(1405) + 1));
273 }
274 if (playing.mistakes >= 10)
275 {
276 playing.index = 0;
277 }
278 Cancel();
279 }
280 else
281 {
283 {
284 if (item.conSleep != null && item.ResistLv(957) <= 0)
285 {
286 item.conSleep.Kill();
287 item.ShowEmo(Emo.angry);
288 }
289 }
290 List<Chara> list = owner.pos.ListWitnesses(owner, 4, WitnessType.music);
291 int num = (owner.Evalue(241) + tool?.Evalue(241)).Value * (100 + toolLv) / 100;
292 int num2 = 0;
293 foreach (Chara item2 in list)
294 {
295 if (owner == null)
296 {
297 break;
298 }
299 if (!reacted.Contains(item2) && EClass.rnd(5) == 0)
300 {
301 if (tool != null)
302 {
303 foreach (Element value in tool.elements.dict.Values)
304 {
305 if (value.id == 489 && EClass.rnd(8) == 0)
306 {
307 item2.AddCondition<ConDrunk>();
308 }
309 if (value.source.categorySub == "eleAttack")
310 {
311 item2.ApplyElementEffect(value, value.Value * 10, owner, checkHostileAct: true);
312 }
313 }
314 }
315 if (owner.IsPCParty)
316 {
317 if (item2.interest <= 0 || (EClass._zone is Zone_Music && (item2.IsPCFaction || item2.IsPCFactionMinion)))
318 {
319 continue;
320 }
321 if (!item2.isDrunk)
322 {
323 item2.interest -= EClass.rnd(10);
324 if (item2.interest < 0)
325 {
326 item2.Talk("musicBored");
327 continue;
328 }
329 }
330 }
331 if (EClass.rnd(num2 * num2) <= 30 && item2.pos.FirstChara == item2)
332 {
333 bool isMinion = item2.IsMinion;
334 p.cancelWhenDamaged = false;
335 if (num < item2.LV && EClass.rnd(2) == 0)
336 {
337 reacted.Add(item2);
338 if (!isMinion)
339 {
340 score -= item2.LV / 2 - 10;
341 }
342 if (EClass.rnd(2) == 0)
343 {
344 item2.Talk("musicBad");
345 }
346 else
347 {
348 item2.Say("musicBad", item2, owner);
349 }
350 item2.ShowEmo(Emo.sad);
351 owner.elements.ModExp(241, 10f);
352 if (EClass.rnd(5) == 0)
353 {
354 ThrowReward(item2, punish: true);
355 }
356 num2++;
357 }
358 else if (EClass.rnd(num + 5) > EClass.rnd(item2.LV * 5 + 1))
359 {
360 reacted.Add(item2);
361 if (!isMinion)
362 {
363 score += EClass.rnd(item2.LV / 2 + 5) + 5;
364 }
365 if (EClass.rnd(2) == 0)
366 {
367 item2.Talk("musicGood");
368 }
369 else
370 {
371 item2.Say("musicGood", item2, owner);
372 }
373 item2.ShowEmo(Emo.happy);
374 item2.renderer.PlayAnime((EClass.rnd(2) == 0) ? AnimeID.Jump : AnimeID.Fishing);
375 owner.elements.ModExp(241, EClass._zone.IsUserZone ? 10 : 50);
376 if (!isMinion)
377 {
378 ThrowReward(item2, punish: false);
379 }
380 num2++;
381 }
382 p.cancelWhenDamaged = true;
383 }
384 }
385 }
386 if (owner != null && owner.IsPC && EClass.rnd(80) < num2)
387 {
388 owner.stamina.Mod(-1);
389 }
390 }
391 },
392 onProgressComplete = delegate
393 {
394 if (EClass.rnd(2) == 0)
395 {
396 LevelSong(2);
397 }
398 if ((bool)playing.bgm)
399 {
400 playing.index++;
401 playing.mistakes = 0;
402 if (playing.index >= playing.bgm.song.parts.Count)
403 {
404 playing.index = 0;
405 }
406 playing.bgm.song.index = playing.index;
407 }
408 Evaluate(success: true);
409 }
410 }.SetDuration(26);
411 yield return Do(progress);
412 if (progress.status == Status.Fail)
413 {
414 yield return Cancel();
415 }
416 void LevelSong(int a)
417 {
418 if (a > 0)
419 {
420 song.lv += a + EClass.rnd(2);
421 if (owner == EClass.pc)
422 {
423 Msg.Say("level_song");
424 }
425 }
426 }
427 }
AnimeID
Definition: AnimeID.cs:2
Emo
Definition: Emo.cs:2
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
WitnessType
Definition: WitnessType.cs:2
Status Do(AIAct _seq, Func< Status > _onChildFail=null)
Definition: AIAct.cs:430
virtual Status Cancel()
Definition: AIAct.cs:305
Status status
Definition: AIAct.cs:16
Status
Definition: AIAct.cs:8
Status DoGoto(Point pos, int dist=0, bool ignoreConnection=false, Func< Status > _onChildFail=null)
Definition: AIAct.cs:446
int progress
Definition: AIProgress.cs:5
void ThrowReward(Chara c, bool punish)
void PlayAnime(AnimeID id, bool force)
bool isDestroyed
Definition: Card.cs:76
ElementContainerCard elements
Definition: Card.cs:42
string id
Definition: Card.cs:36
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:6375
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3180
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:6935
ICardParent parent
Definition: Card.cs:56
bool ExistsOnMap
Definition: Card.cs:2123
void ApplyElementEffect(Element e, int eleP, Card origin, bool checkHostileAct=false)
Definition: Card.cs:4937
Point pos
Definition: Card.cs:60
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
Definition: Card.cs:6343
ThingContainer things
Definition: Card.cs:39
int Evalue(int ele)
Definition: Card.cs:2611
void PlayAnime(AnimeID id, bool force=false)
Definition: Card.cs:6394
CardRenderer renderer
Definition: Card.cs:62
int LV
Definition: Card.cs:387
Definition: Chara.cs:10
Condition AddCondition(string id, int p=100, bool force=false)
Definition: Chara.cs:9451
bool isDrunk
Definition: Chara.cs:126
SourceJob.Row job
Definition: Chara.cs:468
override bool IsPCParty
Definition: Chara.cs:629
int interest
Definition: Chara.cs:319
override bool IsMinion
Definition: Chara.cs:641
override bool IsPCFaction
Definition: Chara.cs:685
override bool IsPCFactionMinion
Definition: Chara.cs:669
override void LookAt(Card c)
Definition: Chara.cs:3597
bool enable
Definition: CoreDebug.cs:286
static Zone _zone
Definition: EClass.cs:21
static Map _map
Definition: EClass.cs:19
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
static CoreDebug debug
Definition: EClass.cs:49
static SoundManager Sound
Definition: EClass.cs:47
static UI ui
Definition: EClass.cs:17
Definition: EInput.cs:8
static void Consume(int _skipFrame)
Definition: EInput.cs:667
void ModExp(int ele, float a, bool chain=false)
Dictionary< int, Element > dict
int id
Definition: ELEMENT.cs:255
SourceElement.Row source
Definition: ELEMENT.cs:278
int Value
Definition: ELEMENT.cs:297
ConfigPreference preference
Definition: Game.cs:97
Config config
Definition: Game.cs:219
int lv
Definition: KnownSong.cs:6
List< Chara > ListCharasInCircle(Point center, float radius, bool los=true)
Definition: Map.cs:2291
Color Ono
Definition: MsgColors.cs:13
Definition: Msg.cs:5
static MsgColors colors
Definition: Msg.cs:20
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
static void SetColor()
Definition: Msg.cs:22
Dictionary< string, KnownSong > knownSongs
Definition: Player.cs:1101
PlayingSong playingSong
Definition: Player.cs:1279
string idTool
Definition: PlayingSong.cs:5
string id
Definition: PlayingSong.cs:3
int mistakes
Definition: PlayingSong.cs:9
List< Chara > ListWitnesses(Chara criminal, int radius=4, WitnessType type=WitnessType.crime, Chara target=null)
Definition: Point.cs:830
bool IsBlocked
Definition: Point.cs:363
Thing Find(int uid)
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
void SetSong(SoundSource _source, BGMData _bgm, BGMData.Part _part)
Definition: UISong.cs:29
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67
Definition: Zone.cs:12
virtual bool IsUserZone
Definition: Zone.cs:273

References EClass._map, EClass._zone, Chara.AddCondition(), Card.AddThing(), Card.ApplyElementEffect(), PlayingSong.bgm, AIAct.Cancel(), Msg.colors, Game.config, EInput.Consume(), ThingGen.Create(), EClass.debug, Debug, ElementContainer.dict, AIAct.DoGoto(), Card.elements, CoreDebug.enable, Evaluate(), Card.Evalue(), Card.ExistsOnMap, ThingContainer.Find(), EClass.game, Lang.GetList(), gold, Card.id, Element.id, PlayingSong.id, PlayingSong.idTool, if(), PlayingSong.index, UISong.Instance, Chara.interest, Point.IsBlocked, Card.isDestroyed, Chara.isDrunk, Chara.IsMinion, Chara.IsPC, Chara.IsPCFaction, Chara.IsPCFactionMinion, Chara.IsPCParty, Zone.IsUserZone, item, Chara.job, keepPlaying, ConfigPreference.keepPlayingMusic, Player.knownSongs, Map.ListCharasInCircle(), Point.ListWitnesses(), Chara.LookAt(), Card.LV, KnownSong.lv, PlayingSong.mistakes, Stats.Mod(), ElementContainer.ModExp(), MsgColors.Ono, AIAct.owner, Card.parent, EClass.pc, CardRenderer.PlayAnime(), Card.PlayAnime(), EClass.player, playing, Player.playingSong, playingTool, Card.PlaySound(), Card.pos, Game.Config.preference, AIProgress.progress, Card.renderer, EClass.rnd(), Msg.Say(), Card.Say(), score, Msg.SetColor(), UISong.SetSong(), Card.ShowEmo(), EClass.Sound, Element.source, PlayingSong.source, Chara.stamina, Card.Talk(), Card.things, ThrowReward(), tool, toolLv, EClass.ui, Util, and Element.Value.

◆ ThrowReward()

void AI_PlayMusic.ThrowReward ( Chara  c,
bool  punish 
)
inline

Definition at line 466 of file AI_PlayMusic.cs.

467 {
468 Thing thing = null;
469 string text = "";
470 int num = 1;
471 bool flag = true;
472 if (punish)
473 {
474 text = ((EClass.rnd(5) == 0) ? "rock" : "pebble");
475 if (EClass.rnd(8) == 0)
476 {
477 text = ((EClass.rnd(3) == 0) ? "water_dirty" : "water");
478 }
479 if (!c.IsPCFactionOrMinion)
480 {
481 thing = c.TryGetThrowable()?.Split(1);
482 }
483 }
484 else if (EClass.rnd(100) == 0 && !EClass._zone.IsUserZone)
485 {
486 text = "ecopo";
487 if (EClass.rnd(4) == 0)
488 {
489 text = "gacha_coin";
490 }
491 if (EClass.rnd(4) == 0)
492 {
493 text = "plat";
494 }
495 if (EClass.rnd(3) == 0)
496 {
497 text = "tomato";
498 }
499 if (EClass.rnd(3) == 0)
500 {
501 text = "casino_coin";
502 }
504 {
505 if (c.LV >= 20 && EClass.rnd(10 * (int)Mathf.Pow(2f, EClass.player.flags.reward_killkill + 1)) == 0)
506 {
507 text = "piano_killkill";
508 punish = true;
509 flag = false;
511 }
512 else if (c.LV >= 40 && EClass.rnd(10 * (int)Mathf.Pow(2f, EClass.player.flags.reward_gould + 1)) == 0)
513 {
514 text = "piano_gould";
515 punish = true;
516 flag = false;
518 }
519 }
520 }
521 else
522 {
523 num = (EClass.rnd(c.LV * 2 + 1) + 1) * (100 + toolLv * 2 + owner.Evalue(1405) * 10) / 100;
524 if (c.IsUnique)
525 {
526 num *= 2;
527 }
528 if (!(EClass._zone is Zone_Music))
529 {
530 if (num > 25)
531 {
532 num /= 2;
533 }
534 if (num > 50)
535 {
536 num /= 2;
537 }
538 if (num > 100)
539 {
540 num /= 2;
541 }
543 {
544 num /= 5;
545 }
546 }
547 if (num < 1)
548 {
549 num = 1;
550 }
551 gold += num;
552 text = "money";
553 }
554 if (!owner.IsPCParty && !punish && text != "money")
555 {
556 return;
557 }
558 if (thing == null)
559 {
560 thing = ThingGen.Create(text, -1, owner.LV).SetNum(num);
561 }
562 ignoreDamage = true;
563 ActThrow.Throw(c, owner.pos, thing, (!punish) ? ThrowMethod.Reward : ThrowMethod.Punish);
564 ignoreDamage = false;
565 if (owner == null || !thing.ExistsOnMap)
566 {
567 return;
568 }
569 if (!owner.IsPC && owner.things.IsFull())
570 {
571 thing.Destroy();
572 }
573 else
574 {
576 {
577 return;
578 }
579 if (flag)
580 {
581 owner.Pick(thing);
582 }
583 if (thing.id == "money" && !owner.IsPC)
584 {
585 int? obj = ((owner.Evalue(241) + tool?.Evalue(241)) * 10 + 100) / ((owner.IsPCFaction && owner.memberType == FactionMemberType.Default) ? 1 : 10);
586 if (owner.GetCurrency() - obj > 0)
587 {
588 owner.c_allowance += num;
589 owner.ModCurrency(-num);
590 }
591 }
592 }
593 }
FactionMemberType
ThrowMethod
Definition: ThrowMethod.cs:2
static bool ignoreDamage
Definition: AI_PlayMusic.cs:14
static EffectIRenderer Throw(Card c, Point p, Thing t, ThrowMethod method=ThrowMethod.Default, float failChance=0f)
Definition: ActThrow.cs:97
bool IsPCFactionOrMinion
Definition: Card.cs:2312
Thing Split(int a)
Definition: Card.cs:3566
bool IsUnique
Definition: Card.cs:2129
Thing SetNum(int a)
Definition: Card.cs:3577
int GetCurrency(string id="money")
Definition: Card.cs:4057
void ModCurrency(int a, string id="money")
Definition: Card.cs:4043
void Destroy()
Definition: Card.cs:5164
override bool IsAliveInCurrentZone
Definition: Chara.cs:563
Thing TryGetThrowable()
Definition: Chara.cs:7948
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4381
int reward_killkill
Definition: Player.cs:712
int reward_gould
Definition: Player.cs:700
Flags flags
Definition: Player.cs:1149
bool IsFull(int y=0)
Definition: Thing.cs:8
bool IsInstance
Definition: Zone.cs:491

References EClass._zone, ThingGen.Create(), Card.Destroy(), Card.ExistsOnMap, Player.flags, Card.id, Zone.IsInstance, Card.IsPCFactionOrMinion, Card.IsUnique, Zone.IsUserZone, Card.LV, EClass.player, Card.pos, Player.Flags.reward_gould, Player.Flags.reward_killkill, EClass.rnd(), Card.SetNum(), Card.Split(), ActThrow.Throw(), tool, and Chara.TryGetThrowable().

Referenced by Run().

Member Data Documentation

◆ gold

int AI_PlayMusic.gold

Definition at line 20 of file AI_PlayMusic.cs.

Referenced by Run().

◆ ignoreDamage

bool AI_PlayMusic.ignoreDamage
static

Definition at line 14 of file AI_PlayMusic.cs.

◆ keepPlaying

bool AI_PlayMusic.keepPlaying
static

Definition at line 8 of file AI_PlayMusic.cs.

Referenced by AM_Adv._OnUpdateInput(), CancelKeepPlaying(), Scene.OnUpdate(), and Run().

◆ playing

PlayingSong AI_PlayMusic.playing

Definition at line 16 of file AI_PlayMusic.cs.

Referenced by Run().

◆ playingTool

Thing AI_PlayMusic.playingTool
static

Definition at line 10 of file AI_PlayMusic.cs.

Referenced by AM_Adv._OnUpdateInput(), CancelKeepPlaying(), and Run().

◆ score

int AI_PlayMusic.score

Definition at line 18 of file AI_PlayMusic.cs.

Referenced by Run().

◆ tool

Thing AI_PlayMusic.tool

Definition at line 12 of file AI_PlayMusic.cs.

Referenced by Run().

◆ toolLv

int AI_PlayMusic.toolLv

Definition at line 22 of file AI_PlayMusic.cs.

Referenced by Run().

Property Documentation

◆ CancelWhenDamaged

override bool AI_PlayMusic.CancelWhenDamaged
get

Definition at line 26 of file AI_PlayMusic.cs.

◆ ShowProgress

override bool AI_PlayMusic.ShowProgress
get

Definition at line 24 of file AI_PlayMusic.cs.

◆ TargetType

override TargetType AI_PlayMusic.TargetType
get

Definition at line 28 of file AI_PlayMusic.cs.

29 {
30 get
31 {
32 if (tool != null && tool != EClass.pc.Tool)
33 {
34 return TargetType.Any;
35 }
36 return TargetType.Self;
37 }
38 }
Thing Tool
Definition: Card.cs:2450
static TargetTypeSelf Self
Definition: TargetType.cs:7
static TargetTypeAny Any
Definition: TargetType.cs:5

The documentation for this class was generated from the following file: