Beispiel #1
0
    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);
    }
Beispiel #2
0
 public ResultOfAbility(int value, Creatures.AttackResult res)
 {
     Value = value;
     Res   = res;
 }