//don't use bool with client (unity) public bool LaunchSpell(BattleEntities.Character characterBattle, BattleEntities.Spell spell, Grid.Row destination) { List <Grid.Row> range = Grid.GetAOERange(spell.EffectRange.GridRange, destination, characterBattle.Row); List <BattleEntities.Character> targets = new List <BattleEntities.Character>(); if (!characterBattle.LaunchSpell(spell)) { return(false); } EventManager.LaunchSpell(spell, range); for (int i = 0; i < range.Count; i++) { BattleEntities.Character character = null; if ((character = Characters.Find(x => x.Row == range[i])) != null) { targets.Add(character); } } for (int i = 0; i < targets.Count; i++) { targets[i].HitDamages(spell); if (targets[i].IsDead) { m_charactersDead.Add(m_characters.Find(x => x == targets[i])); m_characters.Remove(targets[i]); if (targets[i] == ActualCharacter) { NextCharacterTurn(); } } } if (PlayerLose(m_players[0])) { EndGame(m_players[1]); } else if (PlayerLose(m_players[1])) { EndGame(m_players[0]); } return(true); }
public static void LaunchSpell(BattleEntities.Spell spell, List <Grid.Row> rangeAOE) { OnLaunchSpell?.Invoke(spell, rangeAOE); }