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


C# Unit.getDefensePerc方法代码示例

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


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

示例1: showAttackDecision

        // Shows the player if he/she should attack
        public override AttackInfo showAttackDecision(string skillID, Unit unit, ref Unit defender, ref BattleMap map)
        {
            if(skillID== "basic_attack")
                return base.showAttackDecision(skillID, unit, ref defender, ref map);

            // Variables
            AttackInfo	info=	AttackInfo.create(skillID, map.getFullUnitID(unit.mapPos), map.getFullUnitID(defender.mapPos), ref map);

            if(hasPassive("critical_rage"))
                info.criticalChance=	Math.Max(info.criticalChance+0.05f, 1f);
            switch(skillID)
            {
                case "enrage":
                    info.accuracy=	1f;
                    info.criticalChance=	0f;
                    info.projAttackerStats[2]=	(int)(info.projAttackerStats[2]*1.25f+4f);
                    info.projAttackerStats[2]=	(int)(info.projAttackerStats[2]*(1.25f+stockpiled+((hasPassive("adrenaline_rush")) ? 0.1f : 0f)));
                    info.projAttackerStats[3]=	(int)(info.projAttackerStats[3]*0.80f);

                    info.projDefenderStats[2]=	(int)(info.projDefenderStats[2]*1.25f+4f);
                    info.projDefenderStats[2]=	(int)(info.projDefenderStats[2]*(1.25f+stockpiled+((hasPassive("adrenaline_rush")) ? 0.1f : 0f)));
                    info.projDefenderStats[3]=	(int)(info.projDefenderStats[3]*0.80f);
                    break;

                case "furious_slash":
                    info.damage=	info.calculateDamage(1.1f, 0f, 1f, 1f, ref map);
                    info.projAttackerStats[2]=	(int)(info.projAttackerStats[2]*(1.25f+stockpiled+((hasPassive("adrenaline_rush")) ? 0.1f : 0f)));
                    info.projAttackerStats[3]=	(int)(info.projAttackerStats[3]*0.80f);
                    info.projDefenderStats[0]-=	info.damage;
                    break;

                case "let_loose":
                    info.damage=	info.calculateDamage(ref map);
                    if(defender.getDefensePerc()== 0f)
                        info.damage+=	(int)(unit.defense*0.5f);
                    else
                        info.damage+=	Math.Max((int)(unit.defense*0.5f-defender.defense*defender.getDefensePerc()*0.5f), 4);
                    info.projDefenderStats[0]-=	info.damage;
                    info.projAttackerStats[2]=	(int)(info.projAttackerStats[2]*(1.25f+stockpiled+((hasPassive("adrenaline_rush")) ? 0.1f : 0f)));
                    info.projAttackerStats[3]=	(int)(info.projAttackerStats[3]*0.80f);
                    info.projAttackerStats[3]=	(int)(info.projAttackerStats[3]*0.75f);
                    info.criticalChance=	0f;
                    break;

                case "intimidate":
                    info.projDefenderStats[2]=	(int)(info.projDefenderStats[2]*0.88f);
                    info.projDefenderStats[3]=	(int)(info.projDefenderStats[3]*0.88f);
                    info.projDefenderStats[5]=	(int)(info.projDefenderStats[5]*0.88f);
                    info.criticalChance=	0f;
                    break;

                case "stockpile_rage":
                    info.accuracy=	1f;
                    info.criticalChance=	0f;
                    break;

                case "suicidal_slash":
                    info.damage=	info.calculateDamage(1.2f, 0f, 1f, 1f, ref map);
                    info.projAttackerStats[3]=	(int)(info.projAttackerStats[3]*0.96f);
                    info.projDefenderStats[0]-=	info.damage;
                    break;

                case "piercing_jab":
                    info.damage=	info.calculateDamage(1f, 0f, 0.5f, 1f, ref map);
                    info.projDefenderStats[0]-=	info.damage;
                    info.accuracy=	Math.Max(info.accuracy-0.2f, 0f);
                    break;

                case "counter_swipe":
                    info.damage=	info.calculateDamage(0.75f, 0f, 1f, 1f, ref map);
                    if(defender.getDefensePerc()== 0f)
                        info.damage+=	(int)(defender.attack*0.25f);
                    else
                        info.damage+=	Math.Max((int)(defender.attack*0.25f-defender.defense*defender.getDefensePerc()), 4);
                    info.projDefenderStats[0]-=	info.damage;
                    break;

                case "fury_swipes":
                    info.damage=	info.calculateDamage(0.5f, 0f, 1f, 1f, ref map);
                    info.damage*=	3;
                    info.projDefenderStats[0]-=	info.damage;
                    break;
                case "raging_battlecry":
                    info.projAttackerStats[2]=	(int)(info.projAttackerStats[2]*(1.25f+stockpiled+((hasPassive("adrenaline_rush")) ? 0.1f : 0f)));
                    info.projAttackerStats[3]=	(int)(info.projAttackerStats[3]*0.80f);

                    if(info.attackerID== info.defenderID)
                        info.projDefenderStats[2]=	(int)(info.projDefenderStats[2]*(1.25f+stockpiled+((hasPassive("adrenaline_rush")) ? 0.1f : 0f)));
                    else
                        info.projDefenderStats[2]=	(int)(info.projDefenderStats[2]*1.25f);
                    info.projDefenderStats[3]=	(int)(info.projDefenderStats[3]*0.80f);
                    break;
            }

            return info;
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:97,代码来源:Berserker.cs


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