コード例 #1
0
    public void Attack(Weapons weapon, CombatChar target, bool isCounter)
    {
        // Perform the rolls to see if the attacks was succeded and if its a counter attack already, it doesn't cause another counter.

        int attkRoll = C.skills[weapon.attackSkill].GetMod(target.C.lvl);

        attkRoll += C.attributes[weapon.attackAttr].GetMod(target.C.lvl);
        attkRoll += C.Properties[Properties.Attack].GetValue();
        attkRoll += (int)weapon.hitMod;
        attkRoll += Random.Range(1, 101);
        //attkRoll += CheckForArmorAndWeaponCritical(target);
        int evadeRoll = target.EvadeRoll(this.C.lvl);

        //Debug.Log("attacking " + attkRoll + " x " + evadeRoll );
        if (attkRoll >= evadeRoll)
        {
            bool  isCrit = CriticalRoll(weapon, target);
            float damage = Damage(target, weapon, isCrit);
            target.takeDamage(damage, isCrit, isCounter);
        }
        else if (!isCounter)
        {
            target.CheckForCounter(weapon, this);
        }
    }
コード例 #2
0
 public override void Effect(CombatChar target)
 {
     targetChar = target;
     targetChar.takeDamage(castDamage, false, false, true);
     target.sprite.GetComponent <SpriteRenderer>().color = Color.green;
     target.C.fillLife.color = Color.green;
 }