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


C# Unit.takeDamage方法代码示例

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


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

示例1: attackUnit

        // Makes the unit attack the given unit, given that unit's coords on the map, the name of the attack, and a reference to the map
        public override bool attackUnit(Unit unit, bool initiatedAttack, ref Unit victim, int x, int y, ref AttackInfo info, ref BattleMap map)
        {
            switch(info.skillID)
            {
                case "basic_attack":
                case "precise_strike":
                case "serpent\'s_sting":
                case "vigilant_strike":
                case "lethal_strike":
                {
                    if(victim== null)
                        break;

                    victim.takeDamage(ref info, ref unit, ref map);
                    unit.mana=	info.projAttackerStats[1];

                    if(!info.missed && unit.isAlive && !unit.isAI)
                        unit.gainExp(ref victim, ref map);
                };return true;

                case "meditation":	{
                    unit.health=	info.projAttackerStats[0];
                    unit.mana=	info.projAttackerStats[1];
                    unit.attack=	info.projAttackerStats[2];
                    unit.originalAttack=	info.projAttackerStats[2];
                };return true;

                case "hone_skill":	{
                    isSkillHoned=	true;
                };return true;

                case "sun\'s_might":	{
                    if(victim== null)
                        break;

                    victim.takeDamage(ref info, ref unit, ref map);
                    unit.health=	Math.Max((int)(unit.health+(0.15f*info.damage)), unit.originalHealth);
                    unit.mana=	Math.Max((int)(info.projAttackerStats[1]+(0.15f*info.damage)), unit.originalMana);

                    if(!info.missed && unit.isAlive && !unit.isAI)
                        unit.gainExp(ref victim, ref map);
                };return true;
            }

            return false;
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:47,代码来源:Samurai.cs

示例2: attackUnit

        // Makes the unit attack the given unit, given that unit's coords on the map, the name of the attack, and a reference to the map
        public override bool attackUnit(Unit unit, bool initiatedAttack, ref Unit victim, int x, int y, ref AttackInfo info, ref BattleMap map)
        {
            switch(info.skillID)
            {
                default:
                case "basic_attack":
                case "piercing_jab":
                case "counter_swipe":
                {
                    if(victim== null)
                        break;
                    victim.takeDamage(ref info, ref unit, ref map);
                    if(!info.missed && unit.isAlive && !unit.isAI)
                        unit.gainExp(ref victim, ref map);
                };return true;

                case "enrage":	{
                    unit.addStatEffect(
                        new StatEffect(
                            EffectType.Buff,
                            "Enrage",
                            "+25% +4 Atk for 3 turns",
                            enrageSE,
                            3
                        ),
                        ref map
                    );
                    unit.addStatEffect(StatEffect.create(StatusEffect.Enraged, 3), ref map);
                    if(!unit.isAI)
                        unit.gainExp(ref unit, ref map);
                };return true;

                case "furious_slash":	{
                    if(victim== null)
                        break;
                    victim.takeDamage(ref info, ref unit, ref map);
                    unit.addStatEffect(StatEffect.create(StatusEffect.Enraged, 3), ref map);
                    if(!info.missed && unit.isAlive && !unit.isAI)
                        unit.gainExp(ref victim, ref map);
                };return true;

                case "let_loose":	{
                    if(victim== null)
                        break;
                    victim.takeDamage(ref info, ref unit, ref map);
                    unit.addStatEffect(StatEffect.create(StatusEffect.Enraged, 3), ref map);
                    unit.addStatEffect(
                        new StatEffect(
                            EffectType.Debuff,
                            "Let Loose",
                            "-25% Def for 3 turns",
                            letLooseSE,
                            3
                        ),
                        ref map
                    );
                    if(!info.missed && unit.isAlive && !unit.isAI)
                        unit.gainExp(ref victim, ref map);
                };return true;

                case "intimidate":	{
                    if(victim== null)
                        break;
                    victim.addStatEffect(
                        new StatEffect(
                            EffectType.Debuff,
                            "Intimidated",
                            "-12% Atk, Def, and Res for 3 turns",
                            intimidateSE,
                            3
                        ),
                        ref map
                    );
                    if(!info.missed && unit.isAlive && !unit.isAI)
                        unit.gainExp(ref victim, ref map);
                };return true;

                case "stockpile_rage":	{
                    stockpiled+=	0.12f;
                    if(!unit.isAI)
                        unit.gainExp(ref unit, ref map);
                };return true;

                case "suicidal_slash":	{
                    if(victim== null)
                        break;
                    unit.defense=	(int)(unit.defense*0.96f);
                    unit.originalDefense=	(int)(unit.originalDefense*0.96f);
                    victim.takeDamage(ref info, ref unit, ref map);
                    if(!info.missed && unit.isAlive && !unit.isAI)
                        unit.gainExp(ref victim, ref map);
                };return true;

                case "fury_swipes":	{
                    if(victim== null)
                        break;

                    // Variables
                    bool	hit=	false;
//.........这里部分代码省略.........
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:101,代码来源:Berserker.cs

示例3: attackUnit

        // Makes the unit attack the given unit, given that unit's coords on the map, the name of the attack, and a reference to the map
        public virtual bool attackUnit(Unit unit, bool initiatedAttack, ref Unit victim, int x, int y, ref AttackInfo info, ref BattleMap map)
        {
            if(victim== null)
                return false;

            if(info.skillID== "basic_attack")
            {
                victim.takeDamage(ref info, ref unit, ref map);

                if(unit.isAlive && !unit.isAI)
                    unit.gainExp(ref victim, ref map);
            }

            return true;
        }
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:16,代码来源:Profession.cs

示例4: attackUnit

        // Makes the unit attack the given unit, given that unit's coords on the map, the name of the attack, and a reference to the map
        public override bool attackUnit(Unit unit, bool initiatedAttack, ref Unit victim, int x, int y, ref AttackInfo info, ref BattleMap map)
        {
            switch(info.skillID)
            {
                case "smite":
                case "basic_attack":	{
                    if(victim== null)
                        return false;

                    victim.takeDamage(ref info, ref unit, ref map);

                    if(!info.missed && unit.isAlive && !unit.isAI)
                        unit.gainExp(ref victim, ref map);
                };break;

                case "multicure":	{
                    // Variables
                    List<int[]>	allies=	map.findAllies(unit.mapPos[0], unit.mapPos[1], 1, 2, map.getTeamID(unit.mapPos));

                    for(int i= 0; i< allies.size; i++)
                        map.teams.items[allies.items[i][0]].units.items[allies.items[i][1]].heal(-1*info.damage, ref unit, ref map);

                    if(unit.isAlive && !unit.isAI)
                        unit.gainExp(64*allies.size, ref map);
                };break;

                case "armor_of_god":	{
                    if(victim== null)
                        return false;
                    unit.addStatEffect(
                        new StatEffect(
                            EffectType.Buff,
                            "Armor of God",
                            "+35 Def and Res",
                            armorOfGodSE,
                            2
                        ),
                        ref map
                    );
                    if(unit.isAlive && !unit.isAI)
                        unit.gainExp(ref victim, ref map);
                };break;

                case "rally_spirit":	{
                    // Variables
                    List<int[]>	allies=	map.findAllies(unit.mapPos[0], unit.mapPos[1], 0, 2, map.getTeamID(unit.mapPos));

                    for(int i= 0; i< allies.size; i++)
                    {
                        map.teams.items[allies.items[i][0]].units.items[allies.items[i][1]].addStatEffect(
                            new StatEffect(
                                EffectType.Buff,
                                "Rally Spirit",
                                "+10% to all stats",
                                rallySpiritSE,
                                3
                            ),
                            ref map
                        );
                    }

                    if(!info.missed && unit.isAlive && !unit.isAI)
                        unit.gainExp(32*allies.size, ref map);
                };break;

                case "rejuvinate":	{
                    if(victim== null)
                        return false;

                    if(victim.getStatusEffect()== null)
                        victim.clearDebuffs();
                    else
                    {
                        if(!victim.clearStatusEffect())
                            info.missed=	false;
                    }

                    if(!info.missed && unit.isAlive && !unit.isAI)
                        unit.gainExp(ref victim, ref map);
                };break;

                case "healing_prayer":	{
                    // Variables
                    List<int[]>	allies=	map.findAllAllies(map.getTeamID(unit.mapPos));

                    for(int i= 0; i< allies.size; i++)
                    {
                        map.teams.items[allies.items[i][0]].units.items[allies.items[i][1]].heal(
                            map.teams.items[allies.items[i][0]].units.items[allies.items[i][1]].originalHealth,
                            ref unit,
                            ref map
                        );
                    }

                    unit.addStatEffect(
                        new StatEffect(
                            EffectType.Debuff,
                            "Humility",
                            "-75% to all stats",
//.........这里部分代码省略.........
开发者ID:pgonzbecer,项目名称:Conquest,代码行数:101,代码来源:Cardinal.cs


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