Exemplo n.º 1
0
 public override void ModifyAttack(Ability_Attack a, Unit actor, Unit target, ref AbilityResultList results)
 {
     if (actor.stats.Defense().x > 0)
     {
         a.ApplyCounter(actor, target, ref results);
     }
 }
Exemplo n.º 2
0
 public void AttackModifiers(Ability_Attack a, Unit actor, Unit target, ref AbilityResultList results)
 {
     foreach (Traits t in traits)
     {
         t.ModifyAttack(a, actor, target, ref results);
     }
 }
 public void SetAbility(Ability a)
 {
     //reset
     abilityName.text   = "";
     usable.sprite      = null;
     targets.sprite     = null;
     abilityStats.text  = "";
     selfEffects.text   = "";
     targetEffects.text = "";
     if (a == null)
     {
         return;
     }
     abilityName.text = a.abilityName;
     usable.sprite    = a.usable.single;
     usable.color     = ColorPallete.GetColor("Highlight Blue");
     targets.sprite   = a.isAOE ? a.targetable.aoe : a.targetable.single;
     targets.color    = a.IsAttack ? ColorPallete.GetColor("Highlight Red") : ColorPallete.GetColor("Green");
     if (a.IsAttack)
     {
         Ability_Attack aa = (Ability_Attack)a;
         abilityStats.text = string.Format("<color={2}><b>Accuracy</b></color>: {0}{1}%\n",
                                           aa.accmod >= 0 ? "+" : "-", aa.accmod, ColorPallete.GetHexColor("Grey"));
         abilityStats.text += string.Format("<color={1}><b>Damage</b></color>: {0}%\n",
                                            aa.dmgmod * 100, ColorPallete.GetHexColor("Red"));
         if (aa.critmod != 0)
         {
             abilityStats.text += string.Format("<color={2}><b>Crit</b></color>: {0}{1}%\n",
                                                aa.critmod >= 0 ? "+" : "-", aa.critmod, ColorPallete.GetHexColor("Yellow"));
         }
     }
     foreach (Effect e in a.SelfBuffs)
     {
         if (selfEffects.text.Length == 0)
         {
             selfEffects.text = "Self: \n";
         }
         selfEffects.text += e.ToString();
     }
     foreach (Effect e in a.TargetBuffs)
     {
         {
             if (targetEffects.text.Length == 0)
             {
                 targetEffects.text = "Target: \n";
             }
             targetEffects.text += e.ToString();
         }
     }
 }
Exemplo n.º 4
0
 public virtual void ModifyAttack(Ability_Attack a, Unit actor, Unit target, ref AbilityResultList results)
 {
 }
Exemplo n.º 5
0
    public void SetAbility(Unit actor, Ability ability, Unit target)
    {
        currentAbility = ability;
        if (ability == null)
        {
            unitName.text = "";
            health.text   = "";
            effects.text  = "";
            return;
        }
        int   lines = 3;
        float width = 200f;
        bool  on    = gameObject.activeSelf;

        if (!on)
        {
            gameObject.SetActive(true);
        }

        unitName.text = target.stats.GetName();
        width         = Mathf.Max(LayoutUtility.GetPreferredWidth(unitName.rectTransform), width);
        Vector2Int hp = target.stats.Health();

        health.text  = string.Format("<color={2}><b>Health</b></color>: {0}/{1}", hp.x, hp.y, ColorPallete.GetHexColor("Green"));
        effects.text = "";
        if (actor == target)
        {
            foreach (Effect e in ability.SelfBuffs)
            {
                if (effects.text.Length == 0)
                {
                    effects.text = "Effects: \n";
                }
                effects.text += e.ToString();
                ++lines;
            }
            if (!ability.usable.self)
            {
                foreach (Effect e in ability.TargetBuffs)
                {
                    if (effects.text.Length == 0)
                    {
                        effects.text = "Effects: \n";
                    }
                    effects.text += e.ToString(target) + "\n";
                    ++lines;
                }
            }
        }
        else
        {
            if (ability.IsAttack)
            {
                Ability_Attack aa = (Ability_Attack)ability;
                effects.text = string.Format("<color={1}><b>Accuracy</b></color>: {0}%\n",
                                             aa.accmod + actor.stats.GetStat(StatType.acc), ColorPallete.GetHexColor("Grey"));
                Vector2Int dmg = aa.DamageRange(actor, target);
                effects.text += string.Format("<color={2}><b>Damage</b></color>: {0} - {1}\n", dmg.x, dmg.y, ColorPallete.GetHexColor("Red"));
                int crit = aa.critmod + actor.stats.GetStat(StatType.crit);
                lines += 3;
                if (crit > 0)
                {
                    effects.text += string.Format("<color={1}><b>Crit</b></color>: {0}%\n", crit, ColorPallete.GetHexColor("Yellow"));
                    ++lines;
                }
            }
            foreach (Effect e in ability.TargetBuffs)
            {
                if (effects.text.Length == 0)
                {
                    effects.text = "Effects: \n";
                }
                effects.text += e.ToString(target) + "\n";
                ++lines;
            }
        }

        width        = Mathf.Max(LayoutUtility.GetPreferredWidth(effects.rectTransform), width);
        rt.sizeDelta = new Vector2(width, lines * unitName.fontSize);
        if (!on)
        {
            gameObject.SetActive(false);
        }
    }