public bool Action(ActionSkill action, List <Character> targetCharacters) { if (!Element.IsUsable(Elements, action.Cost)) { return(false); } ActionStock = () => { _Action(action, targetCharacters); }; return(true); }
public void Update() { if (HP.Now == 0) { return; } elementTimer++; if (elementTimer >= elementTimerMax) { elementTimer = 0; var elements = ElementLing.NextElements(); if (elements != null) { if (true) { var soundPlayer = new Emugen.Sound.SoundPlayer("data/se/システム音4(1秒).mp3", 0.10f, false, Emugen.Sound.SoundPlayer.SoundType.SE); } foreach (var element in elements) { Elements.Add(element); if (playerCard != null) { playerCard.AddElement(element); } if (enemyCard != null) { enemyCard.AddElement(element); } } var elementOver = Elements.Count - 5; if (elementOver > 0) { for (var i = 0; i < elementOver; i++) { Elements.RemoveAt(0); if (playerCard != null) { playerCard.RemoveElement(0); } if (enemyCard != null) { enemyCard.RemoveElement(0); } } } } } // 敵である場合のAI処理 if (enemyCard != null) { if ((Elements.Count > 0) && (!DataCreater.Instance.IsPlayerCharacterAllDead())) { ActionSkill targetAction = null; foreach (var action in Actions) { if (Element.IsUsable(Elements, action.Cost)) { targetAction = action; } } if (targetAction != null) { if (targetAction.Main.TargetWord.IndexOf("横列") == 0) { // 範囲攻撃 var targetCharacters = new List <Character>(); foreach (var i in DataCreater.Instance.playerCharacters) { targetCharacters.Add(i); } Action(targetAction, targetCharacters); } else { // todo : パーティメンバーの前半を優先する… var j = random.Next(DataCreater.Instance.playerCharacters.Count); var targetCharacter = DataCreater.Instance.playerCharacters[j]; while (targetCharacter.HP.Now <= 0) { j = random.Next(DataCreater.Instance.playerCharacters.Count); targetCharacter = DataCreater.Instance.playerCharacters[j]; } var targetCharacters = new List <Character>(); targetCharacters.Add(targetCharacter); Action(targetAction, targetCharacters); } } } } }
public void _Action(ActionSkill actionSkill, List <Character> targetCharacters) { if (!Element.IsUsable(Elements, actionSkill.Cost)) { return; } Action a = () => { foreach (var targetCharacter in targetCharacters) { var targetCard = targetCharacter.GetCharacterCard(); if (actionSkill.Main.EffectWord.IndexOf("HPダメージ") == 0) { var isHit = false; { var command = actionSkill.Main.HitWord.Split(' '); if (command[0] == "命中") { var value = int.Parse(command[1]) + this.BattleStatusParams["ACC"].Now; var value_nd = int.Parse(command[2]); var value_dn = int.Parse(command[3]); for (var i = 0; i < value_nd; i++) { value += random.Next(1, value_dn + 1); } var value_t = targetCharacter.BattleStatusParams["DOGE"].Now; var value_t_nd = 2; var value_t_dn = 6; for (var i = 0; i < value_t_nd; i++) { value_t += random.Next(1, value_t_dn + 1); } if (value > value_t) { isHit = true; } } else { isHit = true; } } if (isHit) { var lastHP = targetCharacter.HP.Now; var command = actionSkill.Main.EffectWord.Split(' '); var value = int.Parse(command[1]) + this.BattleStatusParams["DMG"].Now - targetCharacter.BattleStatusParams["PROT"].Now; var value_nd = int.Parse(command[2]); var value_dn = int.Parse(command[3]); for (var i = 0; i < value_nd; i++) { value += random.Next(1, value_dn + 1); } if (value < 0) { value = 0; } targetCharacter.HP.Now -= value; if (targetCharacter.HP.Now <= 0) { targetCharacter.HP.Now = 0; if (lastHP != 0) { targetCharacter.Elements.Clear(); targetCard.RemoveElementAll(); } } else { targetCard.damageTimer = 0; } targetCard.ShowDamage(value); targetCard.RefreshViewHP(); } else { targetCard.ShowMiss(); } } else if (actionSkill.Main.EffectWord.IndexOf("HP回復") == 0) { var command = actionSkill.Main.EffectWord.Split(' '); var value = int.Parse(command[1]); var value_nd = int.Parse(command[2]); var value_dn = int.Parse(command[3]); for (var i = 0; i < value_nd; i++) { value += random.Next(1, value_dn + 1); } if (value < 0) { value = 0; } targetCharacter.HP.Now += value; if (targetCharacter.HP.Now > targetCharacter.HP.Max) { targetCharacter.HP.Now = targetCharacter.HP.Max; } targetCard.ShowHealing(value); targetCard.RefreshViewHP(); } } }; this.GetCharacterCard().ActionEffect(a, actionSkill); RemoveElement(actionSkill.Cost); }