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


C# Effect.RunEffect方法代码示例

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


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

示例1: ApplyEffect

    // applies the specified effect, or stacks and refreshes it if it is already on
    public bool ApplyEffect(Effect eff)
    {
        //first check if the unit is immune
        if (eff.description.Contains ("Stunned") && immune.Stun) {
            ShowCombatText("Immune", statusCombatText);
            return false;
        } else if (eff.description.Contains ("Snare") && immune.Snare) {
            ShowCombatText("Immune", statusCombatText);
            return false;
        } else if (eff.description.Contains ("Sleep") && immune.Sleep) {
            ShowCombatText("Immune", statusCombatText);
            return false;
        }

        //need to reaply all the buffs

        //set each stat to its base then apply effects
        maxHP = baseHP;
        maxMana = baseMana;
        movespeed = baseMove;
        armourDamageReduction = baseArmour;
        init = baseInit;
        maxAP = baseAP;
        damageDealtMod = 1;
        damageRecievedMod = 1;
        healingRecievedMod = 1;
        healingDealtMod = 1;
        cooldownSpeed = 1;
        bool alreadyHad = false;
        shield = 0;
        dodgeChance = baseDodge;
        blockChance = baseBlock;
        sight = baseSight;
        immune = baseImmune;

        //loop through all the current effects
        foreach (Effect currentEffect in myEffects) {
            // if the new effect already exists add a stack
            if (currentEffect.name.Contains(eff.name)) {
                currentEffect.AddStack();
                alreadyHad = true;
            }
            currentEffect.RunEffect(this, true);
        }

        //if the unit didnt already have the effect add it
        if (!alreadyHad) {
            //if its a shield of damage recieved effect they need to be added at the start
            if (eff.description.Contains("Damage Shield") || eff.description.Contains("Damage Recieved Mod")) {
                myEffects.Insert(0, eff);
            } else {
                myEffects.Add(eff);
            }
            eff.RunEffect(this, true);
        }

        //stop the unit gaining hp
        if (damageDealtMod < 0) {
            damageDealtMod = 0;
        }
        //stop the unit gaining hp
        if (damageRecievedMod < 0) {
            damageRecievedMod = 0;
        }

        //guard points
        blockChance += 4 * guardPoints;

        ShowDebuffs ();

        return true;
    }
开发者ID:JohnEz,项目名称:TileBasedEngine,代码行数:73,代码来源:Unit.cs


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