Elin Decompiled Documentation EA 23.102 Nightly
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 ()
 
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 ()
 
virtual bool CanPerform ()
 
bool Perform (Chara _cc, Card _tc=null, Point _tp=null)
 
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 int GetSourceValue (int 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)
 
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)
 
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)
 
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 int GetResistDamage (int dmg, int v, int power=0)
 
- Static Public Member Functions inherited from EClass
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
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 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 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]
 
virtual bool IsCrime [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 383 of file AI_PlayMusic.cs.

384 {
385 if (owner == null || !owner.IsPC)
386 {
387 return;
388 }
389 if (success)
390 {
391 score = score * 110 / 100;
392 }
393 else
394 {
395 score = score / 2 - 20;
396 }
397 int num = Mathf.Clamp(score / 20 + 1, 0, 9);
398 owner.Say(Lang.GetList("music_result")[num]);
399 if (gold > 0)
400 {
401 owner.Say("music_reward", owner, gold.ToString() ?? "");
402 }
403 if (EClass.rnd(3) != 0)
404 {
405 owner.stamina.Mod(-1);
406 }
407 QuestMusic questMusic = EClass.game.quests.Get<QuestMusic>();
408 if (questMusic != null)
409 {
410 questMusic.score += score;
411 questMusic.sumMoney += gold;
412 int num2 = num / 2 - 1;
413 if (num > 0)
414 {
415 SE.Play("clap" + num2);
416 }
417 }
418 }
new Chara owner
Definition: AIAct.cs:14
void Say(string lang, string ref1=null, string ref2=null)
Definition: Card.cs:6046
override bool IsPC
Definition: Chara.cs:597
Stats stamina
Definition: Chara.cs:955
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
static int rnd(int a)
Definition: EClass.cs:50
QuestManager quests
Definition: Game.cs:179
Definition: Lang.cs:6
static string[] GetList(string id)
Definition: Lang.cs:114
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 522 of file AI_PlayMusic.cs.

523 {
524 if (playing != null && (bool)playing.bgm)
525 {
526 playing.bgm.song.Fail(playing.source, playing.bgm);
527 if ((bool)UISong.Instance)
528 {
530 }
531 playing.source = null;
532 SoundManager.jingleTimer = 1f;
533 }
534 Evaluate(success: false);
535 }
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:65
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 "trumpet":
91 idSong = "trumpet_practice";
92 break;
93 case "piano_gould":
94 idSong = "piano_gould";
95 break;
96 case "piano2":
97 idSong = "piano_neko";
98 break;
99 case "piano":
100 idSong = "piano_kanon";
101 break;
102 case "harpsichord":
103 idSong = "harpsichord_goldberg";
104 break;
105 case "guitar_ash":
106 idSong = "guitar_caccini";
107 break;
108 case "guitar_efrond":
109 idSong = "guitar_dusk";
110 break;
111 case "guitar":
112 idSong = "guitar_air";
113 break;
114 case "harp":
115 idSong = "harp_komori";
116 break;
117 case "lute":
118 idSong = "guitar_sad";
119 break;
120 case "taiko":
121 idSong = "taiko";
122 break;
123 case "mokugyo":
124 idSong = "mokugyo";
125 break;
126 case "mic":
127 idSong = "mic_rachmaninoff";
128 break;
129 case "cello":
130 idSong = "cello_prelude";
131 break;
132 case "instrument_violin":
133 case "panty":
134 idSong = "violin_chaconne";
135 break;
136 case "stradivarius":
137 idSong = "violin_furusato";
138 break;
139 default:
140 idSong = "violin_chaconne";
141 break;
142 }
143 if (owner.IsPC && EClass.player.knownSongs.ContainsKey(idSong))
144 {
145 song = EClass.player.knownSongs[idSong];
146 }
147 if (song == null)
148 {
149 song = new KnownSong();
150 if (owner.IsPC)
151 {
152 EClass.player.knownSongs[idSong] = song;
153 }
154 }
155 playing = new PlayingSong
156 {
157 id = idSong,
158 idTool = tool.id
159 };
160 if (owner.IsPC)
161 {
162 EClass.player.playingSong = playing;
163 }
164 }
165 if (owner.IsPC)
166 {
167 (EClass.Sound.GetData("Instrument/" + idSong) as BGMData).song.index = playing.index;
168 }
169 if (Application.isEditor && owner.IsPC)
170 {
171 song.lv += 10;
172 Debug.Log(song.lv);
173 }
174 List<Chara> reacted = new List<Chara>();
176 {
177 maxProgress = 15,
178 cancelWhenMoved = false,
179 showProgress = false,
180 canProgress = () => tool != null && !tool.isDestroyed,
181 onProgressBegin = delegate
182 {
183 owner.Say("music_start", owner, tool);
184 owner.ShowEmo(Emo.happy, 3f, skipSame: false);
185 if (tool != null && tool.ExistsOnMap)
186 {
188 }
189 owner.PlayAnime(AnimeID.PlayMusic);
190 if (owner.IsPC)
191 {
192 bool flag = false;
193 if (playing.mistakes == 0 && (bool)playing.source && playing.source.isPlaying && playing.source.data.name == idSong)
194 {
195 SoundSource soundSource = playing.source;
196 if (Mathf.Abs(soundSource.source.time - (soundSource.data as BGMData).song.parts[playing.index].start) < 2f && playing.source.source.volume >= 0.1f)
197 {
198 soundSource.KeepPlay();
199 flag = true;
200 Debug.Log("keep:" + soundSource.source.time);
201 }
202 else
203 {
204 EClass.Sound.Stop(soundSource.data, 0.1f);
205 }
206 Debug.Log(playing.source);
207 }
208 if (!flag)
209 {
210 playing.source = owner.PlaySound("Instrument/" + idSong);
211 Debug.Log(playing.source);
212 }
213 playing.bgm = playing.source.data as BGMData;
214 BGMData.Part part = playing.bgm.song.parts[playing.index];
215 if (!UISong.Instance)
216 {
217 Util.Instantiate<UISong>("UI/Util/UISong", EClass.ui.rectDynamicEssential);
218 }
220 if (EClass.Sound.currentBGM != null)
221 {
222 float num3 = 0.5f - 0.1f * (float)playing.index;
223 if (num3 < 0f)
224 {
225 num3 = 0f;
226 }
227 if (EClass.Sound.sourceBGM.volume > EClass.Sound.currentBGM.data.volume * num3)
228 {
229 EClass.Sound.sourceBGM.DOFade(EClass.Sound.currentBGM.data.volume * num3, 3f);
230 }
231 SoundManager.jingleTimer = part.duration / playing.bgm.pitch + playing.bgm.song.fadeIn + 2f;
232 }
233 }
234 },
235 onProgress = delegate(Progress_Custom p)
236 {
238 owner.Say(Lang.GetList("music").RandomItem());
239 Msg.SetColor();
240 if (EClass.debug.enable && EClass.pc.job.id == "pianist")
241 {
242 song.lv = 10000;
243 }
244 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))
245 {
247 if (EClass.rnd(2) == 0)
248 {
249 LevelSong(2 + 2 * EClass.rnd(owner.Evalue(1405) + 1));
250 }
251 if (playing.mistakes >= 10)
252 {
253 playing.index = 0;
254 }
255 Cancel();
256 }
257 else
258 {
260 {
261 if (item.conSleep != null && item.ResistLv(957) <= 0)
262 {
263 item.conSleep.Kill();
264 item.ShowEmo(Emo.angry);
265 }
266 }
267 List<Chara> list = owner.pos.ListWitnesses(owner, 4, WitnessType.music);
268 int num = owner.Evalue(241) * (100 + toolLv) / 100;
269 int num2 = 0;
270 foreach (Chara item2 in list)
271 {
272 if (owner == null)
273 {
274 break;
275 }
276 if (!reacted.Contains(item2) && EClass.rnd(5) == 0)
277 {
278 if (owner.IsPCParty)
279 {
280 if (item2.interest <= 0 || (EClass._zone is Zone_Music && (item2.IsPCFaction || item2.IsPCFactionMinion)))
281 {
282 continue;
283 }
284 item2.interest -= EClass.rnd(10);
285 if (item2.interest < 0)
286 {
287 item2.Talk("musicBored");
288 continue;
289 }
290 }
291 if (EClass.rnd(num2 * num2) <= 30 && item2.pos.FirstChara == item2)
292 {
293 bool isMinion = item2.IsMinion;
294 if (num < item2.LV && EClass.rnd(2) == 0)
295 {
296 reacted.Add(item2);
297 if (!isMinion)
298 {
299 score -= item2.LV / 2 - 10;
300 }
301 if (EClass.rnd(2) == 0)
302 {
303 item2.Talk("musicBad");
304 }
305 else
306 {
307 item2.Say("musicBad", item2, owner);
308 }
309 item2.ShowEmo(Emo.sad);
310 owner.elements.ModExp(241, 10);
311 if (EClass.rnd(5) == 0)
312 {
313 ThrowReward(item2, punish: true);
314 }
315 num2++;
316 }
317 else if (EClass.rnd(num + 5) > EClass.rnd(item2.LV * 5 + 1))
318 {
319 reacted.Add(item2);
320 if (!isMinion)
321 {
322 score += EClass.rnd(item2.LV / 2 + 5) + 5;
323 }
324 if (EClass.rnd(2) == 0)
325 {
326 item2.Talk("musicGood");
327 }
328 else
329 {
330 item2.Say("musicGood", item2, owner);
331 }
332 item2.ShowEmo(Emo.happy);
333 item2.renderer.PlayAnime((EClass.rnd(2) == 0) ? AnimeID.Jump : AnimeID.Fishing);
334 owner.elements.ModExp(241, EClass._zone.IsUserZone ? 10 : 50);
335 if (!isMinion)
336 {
337 ThrowReward(item2, punish: false);
338 }
339 num2++;
340 }
341 }
342 }
343 }
344 if (owner != null && owner.IsPC && EClass.rnd(80) < num2)
345 {
346 owner.stamina.Mod(-1);
347 }
348 }
349 },
350 onProgressComplete = delegate
351 {
352 if (EClass.rnd(2) == 0)
353 {
354 LevelSong(2);
355 }
356 if ((bool)playing.bgm)
357 {
358 playing.index++;
359 playing.mistakes = 0;
360 if (playing.index >= playing.bgm.song.parts.Count)
361 {
362 playing.index = 0;
363 }
364 playing.bgm.song.index = playing.index;
365 }
366 Evaluate(success: true);
367 }
368 }.SetDuration(26);
369 yield return Do(seq);
370 void LevelSong(int a)
371 {
372 if (a > 0)
373 {
374 song.lv += a + EClass.rnd(2);
375 if (owner == EClass.pc)
376 {
377 Msg.Say("level_song");
378 }
379 }
380 }
381 }
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:416
virtual Status Cancel()
Definition: AIAct.cs:291
Status DoGoto(Point pos, int dist=0, bool ignoreConnection=false, Func< Status > _onChildFail=null)
Definition: AIAct.cs:432
int progress
Definition: AIProgress.cs:5
void ThrowReward(Chara c, bool punish)
void PlayAnime(AnimeID id, bool force)
bool isDestroyed
Definition: Card.cs:71
ElementContainerCard elements
Definition: Card.cs:37
string id
Definition: Card.cs:31
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
Definition: Card.cs:5404
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:2901
void Talk(string idTopic, string ref1=null, string ref2=null, bool forceSync=false)
Definition: Card.cs:5949
ICardParent parent
Definition: Card.cs:51
bool ExistsOnMap
Definition: Card.cs:1961
Point pos
Definition: Card.cs:55
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
Definition: Card.cs:5372
ThingContainer things
Definition: Card.cs:34
int Evalue(int ele)
Definition: Card.cs:2431
void PlayAnime(AnimeID id, bool force=false)
Definition: Card.cs:5423
CardRenderer renderer
Definition: Card.cs:57
int LV
Definition: Card.cs:370
Definition: Chara.cs:10
SourceJob.Row job
Definition: Chara.cs:451
override bool IsPCParty
Definition: Chara.cs:600
int interest
Definition: Chara.cs:302
override bool IsMinion
Definition: Chara.cs:612
override bool IsPCFaction
Definition: Chara.cs:656
override bool IsPCFactionMinion
Definition: Chara.cs:640
override void LookAt(Card c)
Definition: Chara.cs:3219
bool enable
Definition: CoreDebug.cs:285
static Zone _zone
Definition: EClass.cs:20
static Map _map
Definition: EClass.cs:18
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
static CoreDebug debug
Definition: EClass.cs:48
static SoundManager Sound
Definition: EClass.cs:46
static UI ui
Definition: EClass.cs:16
Definition: EInput.cs:8
static void Consume(int _skipFrame)
Definition: EInput.cs:656
void ModExp(int ele, int a, bool chain=false)
ConfigPreference preference
Definition: Game.cs:96
Config config
Definition: Game.cs:215
int lv
Definition: KnownSong.cs:6
List< Chara > ListCharasInCircle(Point center, float radius, bool los=true)
Definition: Map.cs:2269
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:847
PlayingSong playingSong
Definition: Player.cs:1020
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:802
bool IsBlocked
Definition: Point.cs:339
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:264

References EClass._map, EClass._zone, Card.AddThing(), PlayingSong.bgm, AIAct.Cancel(), Msg.colors, Game.config, EInput.Consume(), ThingGen.Create(), EClass.debug, Debug, AIAct.DoGoto(), Card.elements, CoreDebug.enable, Evaluate(), Card.Evalue(), Card.ExistsOnMap, ThingContainer.Find(), EClass.game, Lang.GetList(), gold, Card.id, PlayingSong.id, PlayingSong.idTool, if(), PlayingSong.index, UISong.Instance, Chara.interest, Point.IsBlocked, Card.isDestroyed, 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(), Card.Say(), score, Msg.SetColor(), UISong.SetSong(), Card.ShowEmo(), EClass.Sound, PlayingSong.source, Chara.stamina, Card.Talk(), Card.things, ThrowReward(), tool, toolLv, EClass.ui, and Util.

◆ ThrowReward()

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

Definition at line 420 of file AI_PlayMusic.cs.

421 {
422 Thing thing = null;
423 string text = "";
424 int num = 1;
425 if (punish)
426 {
427 text = ((EClass.rnd(5) == 0) ? "rock" : "pebble");
428 if (EClass.rnd(8) == 0)
429 {
430 text = ((EClass.rnd(3) == 0) ? "water_dirty" : "water");
431 }
432 if (!c.IsPCFactionOrMinion)
433 {
434 thing = c.TryGetThrowable()?.Split(1);
435 }
436 }
437 else if (EClass.rnd(100) == 0 && !EClass._zone.IsUserZone)
438 {
439 text = "ecopo";
440 if (EClass.rnd(4) == 0)
441 {
442 text = "gacha_coin";
443 }
444 if (EClass.rnd(4) == 0)
445 {
446 text = "plat";
447 }
448 if (EClass.rnd(3) == 0)
449 {
450 text = "tomato";
451 }
452 if (EClass.rnd(3) == 0)
453 {
454 text = "casino_coin";
455 }
456 }
457 else
458 {
459 num = (EClass.rnd(c.LV * 2 + 1) + 1) * (100 + toolLv * 2 + owner.Evalue(1405) * 10) / 100;
460 if (c.IsUnique)
461 {
462 num *= 2;
463 }
464 if (!(EClass._zone is Zone_Music))
465 {
466 if (num > 25)
467 {
468 num /= 2;
469 }
470 if (num > 50)
471 {
472 num /= 2;
473 }
474 if (num > 100)
475 {
476 num /= 2;
477 }
479 {
480 num /= 5;
481 }
482 }
483 if (num < 1)
484 {
485 num = 1;
486 }
487 gold += num;
488 text = "money";
489 }
490 if (!owner.IsPCParty && !punish && text != "money")
491 {
492 return;
493 }
494 if (thing == null)
495 {
496 thing = ThingGen.Create(text).SetNum(num);
497 }
498 ignoreDamage = true;
499 ActThrow.Throw(c, owner.pos, thing, (!punish) ? ThrowMethod.Reward : ThrowMethod.Punish);
500 ignoreDamage = false;
501 if (owner == null || !thing.ExistsOnMap)
502 {
503 return;
504 }
505 if (!owner.IsPC && owner.things.IsFull())
506 {
507 thing.Destroy();
508 return;
509 }
510 owner.Pick(thing);
511 if (thing.id == "money" && !owner.IsPC)
512 {
513 int num2 = (owner.Evalue(241) * 10 + 100) / ((owner.IsPCFaction && owner.memberType == FactionMemberType.Default) ? 1 : 10);
514 if (owner.GetCurrency() - num2 > 0)
515 {
516 owner.c_allowance += num;
517 owner.ModCurrency(-num);
518 }
519 }
520 }
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:93
bool IsPCFactionOrMinion
Definition: Card.cs:2132
Thing Split(int a)
Definition: Card.cs:3231
bool IsUnique
Definition: Card.cs:1967
Thing SetNum(int a)
Definition: Card.cs:3242
int GetCurrency(string id="money")
Definition: Card.cs:3652
void ModCurrency(int a, string id="money")
Definition: Card.cs:3638
void Destroy()
Definition: Card.cs:4538
Thing TryGetThrowable()
Definition: Chara.cs:7005
FactionMemberType memberType
Definition: Chara.cs:46
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:3920
bool IsFull(int y=0)
Definition: Thing.cs:8

References EClass._zone, ThingGen.Create(), Card.Destroy(), Card.ExistsOnMap, Card.id, Card.IsPCFactionOrMinion, Card.IsUnique, Zone.IsUserZone, Card.LV, Card.pos, EClass.rnd(), Card.SetNum(), Card.Split(), ActThrow.Throw(), 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.

Referenced by Card.DamageHP().

◆ 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:2270
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: