Exemplo n.º 1
0
    ActionInfo ActionCalculation(Action a, BattleActor s, BattleActor r)
    {
        int baseVal = a.actionValue;
        float critVal = 0;
        float defVal = 0;
        float elmtVal = 1;
        
        if(s.GetStat("Luck").GetValue() > Random.Range(0,400))
        {
            critVal = Random.Range(1.5f, 1.75f);
        }
        
        if(r.isDefending)
        {
            float bonusVal = (critVal > 1f) ? 1.2f : 3f;
            defVal = r.GetStat("Defense").GetValue()*bonusVal;
        }
        else
        {
            defVal = r.GetStat("Defense").GetValue()/2;
        }

        elmtVal = GetElementDamageValue(a.element, r.actor.activeElement);       
        
        ActionInfo info;
        info.sender = s;
        info.receiver = r;
        info.critHit = (critVal > 1);
        info.elmtHit = (elmtVal > 1);
        info.finalVal = Mathf.CeilToInt((baseVal * (1 + critVal + elmtVal)) - defVal);
		info.item = new Item();
		info.isDefending = false;
		info.isUsingItem = false;

        return info;
    }
Exemplo n.º 2
0
 public void DoSkill(Skill skill, BattleActor sender, BattleActor receiver)
 {
     sender.GetStat("MP").baseValue -= skill.mpCost;
     
     Action a;
     a.actionValue = skill.damage;
     a.element = skill.element;
     a.type = skill.type;
     
     ActionInfo aInfo = ActionCalculation(a, sender, receiver);
     actionQueue.Add(aInfo);
 }