Esempio n. 1
0
        internal void set_attack(int distance, List <Combat_Action_Data> action_data, Scripted_Combat_Stats stats)
        {
            Game_Unit battler = Attacker == 1 ? Battler1 : Battler2;
            Game_Unit target  = Attacker == 2 ? Battler1 : Battler2;

            // In case of skills like Astra that turn skill_activated back on at the end of reset_skills()
            battler.skill_activated = false;
            if (target != null)
            {
                target.skill_activated = false;
            }

            TactileLibrary.Data_Weapon weapon = battler.actor.weapon;
            // Pre hit skill check, Defender (Bastion)
            //prehit_def_skill_check(distance, action_data, hit, ref hit_skill_changed); //Yeti
            // Pre hit skill check, Attcker (Spiral Dive?)
            //prehit_skill_check(distance, action_data, hit, ref hit_skill_changed); //Yeti

            // Hit test
            //bool hit = stats.Result != Attack_Results.Miss; //Debug
            //bool crt = hit && stats.Result == Attack_Results.Crit;

            // Post hit skill activation (Astra)
            //hit_skill_check(distance, action_data, is_hit, is_crt); //Yeti

            battler.hit_skill_update();
            // On hit skill activation (Determination) //Yeti
            //onhit_skill_check(distance, action_data, is_hit); //Yeti

            // Calculate attack
            Result = calculate_attack(distance, weapon, stats);

            if (Battler2 != null)
            {
                cause_damage(true);
            }
            // Attack end skill activation (Adept) //Yeti
            //posthit_skill_check(distance, action_data); //Yeti
            // Reset skills
            if (!skip_skill_update())
            {
                battler.reset_skills();
                if (target != null)
                {
                    target.reset_skills();
                }
            }
        }
Esempio n. 2
0
        internal void set_attack(int distance, List <Combat_Action_Data> action_data)
        {
            Game_Unit battler = Attacker == 1 ? Battler1 : Battler2;
            Game_Unit target  = Attacker == 2 ? Battler1 : Battler2;

            // In case of skills like Astra that turn skill_activated back on at the end of reset_skills()
            battler.skill_activated = false;
            if (target != null)
            {
                target.skill_activated = false;
            }

            List <int?> combat_stats;
            int         hit = 100, dmg = 0;
            bool        hit_skill_changed = false;

            if (target != null)
            {
                combat_stats = Combat.combat_stats(battler.id, target.id, distance);
                if (combat_stats[0] != null)
                {
                    hit = (int)combat_stats[0];
                }
                if (combat_stats[1] != null)
                {
                    dmg = (int)combat_stats[1];
                }
                hit_skill_changed = false;
            }


            TactileLibrary.Data_Weapon weapon = battler.actor.weapon;
            // Pre hit skill check, Defender (Bastion)
            prehit_def_skill_check(distance, action_data, hit, ref hit_skill_changed);
            // Pre hit skill check, Attcker (Spiral Dive?)
            prehit_skill_check(distance, action_data, hit, ref hit_skill_changed);

            bool is_hit = true, is_crt = false;

            if (target != null)
            {
                combat_stats = Combat.combat_stats(battler.id, target.id, distance);
                // Hit hasn't changed
                hit = attack_hit(hit, combat_stats[0] ?? hit, hit_skill_changed);
                int crt = combat_stats[2] ?? -1;
                // Hit test
                is_hit = true;
                is_crt = false;

                if (Stats[Attacker == 1 ? 0 : 4] != null)
                {
                    Combat.test_hit(hit, crt, distance, out is_hit, out is_crt);
                }
            }
            // Post hit skill activation (Astra)
            hit_skill_check(distance, action_data, is_hit, is_crt);

            battler.hit_skill_update();
            // On hit skill activation (Determination) //Yeti
            onhit_skill_check(distance, action_data, is_hit);

            // Calculate attack
            if (target != null)
            {
                combat_stats = Combat.combat_stats(battler.id, target.id, distance);
                if (combat_stats[1] != null)
                {
                    dmg = attack_dmg(dmg, (int)combat_stats[1]);
                }
            }

            Result = calculate_attack(distance, dmg, is_hit, is_crt, weapon);

            if (Battler2 != null)
            {
                cause_damage(true);
            }
            // Attack end skill activation (Adept) //Yeti
            posthit_skill_check(distance, action_data);
            // Reset skills
            if (!skip_skill_update())
            {
                battler.reset_skills();
                if (target != null)
                {
                    target.reset_skills();
                }
            }
        }