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


C# Attack.is_armor_breaking_attack方法代码示例

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


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

示例1: 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


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