/// <summary> /// задает начальные значения словарю ResultsForAnim /// </summary> /// <param name="room"> /// текущая комната, в которой применяется способность /// </param> /// <returns> /// словарь с нанесенным уроном или лечением по всем существам в комнате. /// Нужен для передачи в скрипт, управляющий анимацией. /// </returns> public Dictionary <Creatures, ResultOfAbility> AwakeResForAnim(RoomType room) { Dictionary <Creatures, ResultOfAbility> res = new Dictionary <Creatures, ResultOfAbility>(); foreach (Creatures c in room.HeroesAndMobs) { res[c] = new ResultOfAbility(0, Creatures.AttackResult.Hit); } return(res); }
public override void UseAbility(Creatures target, Creatures user, RoomType room) { Dictionary <Creatures, ResultOfAbility> ResultsForAnim = AwakeResForAnim(room); Creatures.AttackResult res = Attack(user, target); int damage = user.GetResultStat(Stats.Strength) * 2 + ALevel * 2 + Random.Range(user.GetResultStat(Stats.MinDmg), target.GetResultStat(Stats.MaxDmg) + 1); switch (res) { case Creatures.AttackResult.Miss: { //miss ResultsForAnim[target] = new ResultOfAbility(0, Creatures.AttackResult.Miss); } break; case Creatures.AttackResult.Glance: { //glance target.ChangeResultStat(Stats.Hp, -damage / 2); ResultsForAnim[target] = new ResultOfAbility(-damage / 2, Creatures.AttackResult.Glance); } break; case Creatures.AttackResult.Hit: { //hit target.ChangeResultStat(Stats.Hp, -damage); ResultsForAnim[target] = new ResultOfAbility(-damage, Creatures.AttackResult.Hit); } break; case Creatures.AttackResult.Crit: { //crit target.ChangeResultStat(Stats.Hp, -damage * 2); ResultsForAnim[target] = new ResultOfAbility(-damage * 2, Creatures.AttackResult.Crit); } break; default: break; } target.TestLive(); Messenger <Dictionary <Creatures, ResultOfAbility> > .Broadcast(GameEvent.ABILITY_INFO, ResultsForAnim); }
public override void UseAbility(Creatures target, Creatures healer, RoomType room) { Dictionary <Creatures, ResultOfAbility> ResultsForAnim = AwakeResForAnim(room); //сделать проверку на макс хп int healHp = healer.GetResultStat(Stats.Stamina) * 2 + ALevel * 2 + Random.Range(3, 9); target.ChangeResultStat(Stats.Hp, healHp); //if (target.DynamicStats[Creatures.Stats.Hp] > target) ResultsForAnim[target] = new ResultOfAbility(healHp, Creatures.AttackResult.Hit); //сделать отдельный результат атаки - хилл target.TestLive(); Messenger <Dictionary <Creatures, ResultOfAbility> > .Broadcast(GameEvent.ABILITY_INFO, ResultsForAnim); }