当前位置: 首页>>代码示例>>C#>>正文


C# Attack.get_damage_amt方法代码示例

本文整理汇总了C#中Attack.get_damage_amt方法的典型用法代码示例。如果您正苦于以下问题:C# Attack.get_damage_amt方法的具体用法?C# Attack.get_damage_amt怎么用?C# Attack.get_damage_amt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Attack的用法示例。


在下文中一共展示了Attack.get_damage_amt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: take_aoe_damage

        public void take_aoe_damage(int min_dmg, int max_dmg, 
                                    Attack.Damage dmg_type, Floor fl)
        {
            List<Limb> target_limbs = new List<Limb>();
            List<Armor.Attack_Zone> target_zones = new List<Armor.Attack_Zone>();

            //Head and chest
            int hc_dodge_roll = rGen.Next(100);
            if (hc_dodge_roll < dodge_chance)
            {
                fl.add_new_popup("Dodged!", Popup.popup_msg_type.Dodge, my_grid_coord, false, false);
                message_buffer.Add("You dodge the attack!");
            }
            else
            {

                int h_wnd = rGen.Next(min_dmg, max_dmg+1);
                Attack head_attack = new Attack(dmg_type, h_wnd);
                if (helm != null)
                    head_attack = helm.absorb_damage(head_attack, my_grid_coord,
                                                     ref rGen, ref message_buffer, ref fl);
                Head.add_injury(dmg_type, h_wnd);

                target_limbs.Add(Torso);
                target_zones.Add(Armor.Attack_Zone.Chest);
            }

            //R Arm / Leg
            int rs_dodge_roll = rGen.Next(100);
            if (rs_dodge_roll < dodge_chance)
            {
                fl.add_new_popup("Dodged!", Popup.popup_msg_type.Dodge, my_grid_coord, false, false);
                message_buffer.Add("You dodge the attack!");
            }
            else
            {
                target_limbs.Add(R_Arm);
                target_zones.Add(Armor.Attack_Zone.R_Arm);
                target_limbs.Add(R_Leg);
                target_zones.Add(Armor.Attack_Zone.R_Leg);
            }

            //L Arm / Leg
            int ls_dodge_roll = rGen.Next(100);
            if (ls_dodge_roll < dodge_chance)
            {
                fl.add_new_popup("Dodged!", Popup.popup_msg_type.Dodge, my_grid_coord, false, false);
                message_buffer.Add("You dodge the attack!");
            }
            else
            {
                target_limbs.Add(L_Arm);
                target_zones.Add(Armor.Attack_Zone.L_Arm);
                target_limbs.Add(L_Leg);
                target_zones.Add(Armor.Attack_Zone.L_Leg);
            }

            for (int i = 0; i < target_limbs.Count; i++)
            {
                Attack next_attack = new Attack(dmg_type, rGen.Next(min_dmg, max_dmg+1));
                int atk_dmg = next_attack.get_damage_amt();

                if (over_armor != null)
                    next_attack = over_armor.absorb_damage(next_attack, my_grid_coord, ref rGen, ref message_buffer, ref fl);
                if (under_armor != null)
                    next_attack = under_armor.absorb_damage(next_attack, my_grid_coord, ref rGen, ref message_buffer, ref fl);

                target_limbs[i].add_injury(next_attack.get_dmg_type(), next_attack.get_damage_amt());
                if (next_attack.get_damage_amt() > 0)
                    fl.add_new_popup("-" + next_attack.get_damage_amt() + " " + target_limbs[i].get_shortname(), Popup.popup_msg_type.Damage, my_grid_coord, next_attack.get_damage_amt() < atk_dmg, false, dmg_type);
                message_buffer.Add("Your " + target_limbs[i].get_longname() + " takes " + next_attack.get_damage_amt() + " wounds!");
            }

            handle_postdamage_calculations();

            if (my_class == Chara_Class.Warrior)
                c_energy += 12 + rGen.Next(18);
        }
开发者ID:Chupaflor,项目名称:Cronkpit_Samples,代码行数:78,代码来源:Player.cs

示例2: take_damage

        public void take_damage(Attack atk, Floor fl, string specific_part)
        {
            //OKAY THIS IS GONNA BE COMPLICATED.
            //First, figure out where the attack is gonna hit. The breakdown is as follows:
            //head, 5%, chest = 25%, arm = 17%, leg = 18%
            int hit_location = rGen.Next(100);
            int overall_damage = atk.get_damage_amt();
            int armor_absorbed = 0;

            switch (specific_part)
            {
                case "Head":
                    hit_location = 0;
                    break;
                case "Chest":
                    hit_location = 76;
                    break;
                case "LArm":
                    hit_location = 23;
                    break;
                case "RArm":
                    hit_location = 6;
                    break;
                case "LLeg":
                    hit_location = 58;
                    break;
                case "RLeg":
                    hit_location = 40;
                    break;
            }

            int dodge_roll = rGen.Next(100);
            bool dodged = false;

            if (dodge_roll < dodge_chance)
            {
                dodged = true;
                fl.add_new_popup("Dodged!", Popup.popup_msg_type.Dodge, my_grid_coord, false, false);
                message_buffer.Add("You dodge the attack!");
            }

            if (!dodged)
            {
                bool head_shot = false;
                Limb target_limb = null;

                if (hit_location < 5 && !Head.is_disabled())
                {
                    head_shot = true;
                    target_limb = Head;
                }
                else if (hit_location >= 5 && hit_location < 22 && !R_Arm.is_disabled())
                    target_limb = R_Arm;
                else if (hit_location >= 22 && hit_location < 39 && !L_Arm.is_disabled())
                    target_limb = L_Arm;
                else if (hit_location >= 39 && hit_location < 57 && !R_Leg.is_disabled())
                    target_limb = R_Leg;
                else if (hit_location >= 57 && hit_location < 75 && !L_Leg.is_disabled())
                    target_limb = L_Leg;
                else
                    target_limb = Torso;

                if (!head_shot)
                {
                    if (over_armor != null)
                        atk = over_armor.absorb_damage(atk, my_grid_coord, ref rGen, ref message_buffer, ref fl);
                    if (under_armor != null)
                        atk = under_armor.absorb_damage(atk, my_grid_coord, ref rGen, ref message_buffer, ref fl);
                }
                else
                {
                    if (helm != null)
                        atk = helm.absorb_damage(atk, my_grid_coord, ref rGen, ref message_buffer, ref fl);
                }

                for (int i = 0; i < BuffDebuffTracker.Count; i++)
                {
                    if (BuffDebuffTracker[i].get_my_type() == Scroll.Status_Type.LesserMageArmor ||
                        BuffDebuffTracker[i].get_my_type() == Scroll.Status_Type.LesserSOF)
                        handle_armor_buffs(BuffDebuffTracker[i].get_my_type(), ref atk);
                }
                armor_absorbed = overall_damage - atk.get_damage_amt();

                int dmg = atk.get_damage_amt();
                target_limb.add_injury(atk.get_dmg_type(), dmg);
                if (dmg > 0)
                    fl.add_new_popup("-" + dmg + " " + target_limb.get_shortname(), Popup.popup_msg_type.Damage, my_grid_coord, armor_absorbed > 0, false, atk.get_dmg_type());
                message_buffer.Add("Your " + target_limb.get_longname() + " takes " + dmg + " wounds!");
            }

            handle_postdamage_calculations();

            if (my_class == Chara_Class.Warrior)
            {
                c_energy += 2 + rGen.Next(3);
                if (atk.is_armor_breaking_attack())
                    c_energy++;
            }

            if (!is_alive())
//.........这里部分代码省略.........
开发者ID:Chupaflor,项目名称:Cronkpit_Samples,代码行数:101,代码来源:Player.cs

示例3: handle_armor_buffs

        public void handle_armor_buffs(Scroll.Status_Type fx_type, ref Attack atk)
        {
            int slash_resist = 0;
            int crush_resist = 0;
            int pierce_resist = 0;
            int fire_resist = 0;
            int acid_resist = 0;
            int frost_resist = 0;
            int elec_resist = 0;

            switch (fx_type)
            {
                case Scroll.Status_Type.LesserMageArmor:
                    slash_resist = 3;
                    crush_resist = 2;
                    pierce_resist = 3;
                    fire_resist = 1;
                    frost_resist = 1;
                    acid_resist = 1;
                    elec_resist = 2;
                    break;
                case Scroll.Status_Type.LesserSOF:
                    slash_resist = 1;
                    crush_resist = 1;
                    pierce_resist = 2;
                    fire_resist = 1;
                    frost_resist = 2;
                    acid_resist = 1;
                    elec_resist = 1;
                    break;
            }

            int atk_dmg = atk.get_damage_amt();
            switch (atk.get_dmg_type())
            {
                case Attack.Damage.Acid:
                    atk.reset_dmg(atk_dmg - acid_resist);
                    break;
                case Attack.Damage.Crushing:
                    atk.reset_dmg(atk_dmg - crush_resist);
                    break;
                case Attack.Damage.Electric:
                    atk.reset_dmg(atk_dmg - elec_resist);
                    break;
                case Attack.Damage.Fire:
                    atk.reset_dmg(atk_dmg - fire_resist);
                    break;
                case Attack.Damage.Frost:
                    atk.reset_dmg(atk_dmg - frost_resist);
                    break;
                case Attack.Damage.Piercing:
                    atk.reset_dmg(atk_dmg - pierce_resist);
                    break;
                case Attack.Damage.Slashing:
                    atk.reset_dmg(atk_dmg - slash_resist);
                    break;
            }
        }
开发者ID:Chupaflor,项目名称:Cronkpit_Samples,代码行数:58,代码来源:Player.cs


注:本文中的Attack.get_damage_amt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。