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


C# Ability.GetDamage方法代码示例

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


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

示例1: CalculateDamage


//.........这里部分代码省略.........
                case "undying_soul_rip":
                    var radius = ability.GetAbilityData("radius");
                    var nearUnits =
                        ObjectMgr.GetEntities<Unit>()
                            .Where(
                                x =>
                                !x.Equals(source) && !x.Equals(target)
                                && (x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Creep
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Creature
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Invoker_Forged_Spirit
                                    || x.ClassID == ClassID.CDOTA_Unit_Undying_Zombie
                                    || x.ClassID == ClassID.CDOTA_BaseNPC_Warlock_Golem
                                    || (x is Hero
                                        && (x.Team == source.Team
                                            || (x.Team == source.GetEnemyTeam() && !x.IsMagicImmune())))) && x.IsAlive
                                && x.IsVisible && x.Distance2D(source) < radius + x.HullRadius);
                    var damagePerUnit = ability.GetAbilityData("damage_per_unit");
                    var maxUnits = ability.GetAbilityData("max_units");
                    outgoingDamage = Math.Min(nearUnits.Count(), maxUnits) * damagePerUnit;
                    outgoingDamage = target.DamageTaken(
                        outgoingDamage, 
                        DamageType.Magical, 
                        source, 
                        data.MagicImmunityPierce, 
                        minusMagicResistancePerc: minusMagicResistancePerc);
                    break;
                default:
                    var damageString = data.DamageString;
                    if (damageString == null)
                    {
                        outgoingDamage = ability.GetDamage(level - 1);

                        // Convert.ToSingle(
                        // Game.FindKeyValues(name + "/AbilityDamage", KeyValueSource.Ability)
                        // .StringValue.Split(' ')[level - 1]);
                    }
                    else
                    {
                        if (ability.AbilityType.HasFlag(AbilityType.Ultimate) && level > 0 && source.AghanimState())
                        {
                            level -= 1;
                        }

                        if (data.SpellLevel != null)
                        {
                            var spellLevel = source.FindSpell(data.SpellLevel);
                            level = spellLevel.Level;
                        }

                        if (source.ClassID == ClassID.CDOTA_Unit_Hero_Invoker && level > 0 && source.AghanimState())
                        {
                            level += 1;
                        }

                        if (data.DamageScepterString != null && source.AghanimState())
                        {
                            outgoingDamage = ability.GetAbilityData(data.DamageScepterString, level);
                        }
                        else
                        {
                            outgoingDamage = ability.GetAbilityData(damageString, level);
                        }
开发者ID:nbIxMaN,项目名称:Ensage.Common,代码行数:66,代码来源:AbilityDamage.cs

示例2: Game_OnUpdate


//.........这里部分代码省略.........
                            _rangeDisplay.SetControlPoint(3, new Vector3(20, 0, 0));
                            _rangeDisplay.SetControlPoint(2, new Vector3(_lastRange, 255, 0));
                        }
                    }
                    else
                    {
                        if (!_me.IsAlive)
                        {
                            _rangeDisplay.Dispose();
                            _rangeDisplay = null;
                        }
                        else if (_lastRange != _attackRange)
                        {
                            _rangeDisplay.Dispose();
                            _lastRange = _attackRange;
                            _rangeDisplay = _me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf");
                            _rangeDisplay.SetControlPoint(1, new Vector3(255, 80, 50));
                            _rangeDisplay.SetControlPoint(3, new Vector3(15, 0, 0));
                            _rangeDisplay.SetControlPoint(2, new Vector3(_lastRange, 255, 0));
                        }
                    }
                }
                else
                {
                    if (_rangeDisplay != null) _rangeDisplay.Dispose();
                    _rangeDisplay = null;
                }

                if (Game.IsKeyDown(Menu.Item("harass").GetValue<KeyBind>().Key) && Utils.SleepCheck("cast"))
                {
                    Autoattack(0, 0);
                    _creepTarget = GetLowestHpCreep(_me, null);
                    _creepTarget = KillableCreep(false, _creepTarget, ref wait);
                    Console.WriteLine(_me.MinimumDamage + qDamage[_q.Level] * _me.MaximumMana / 100+"-"+_q.GetDamage(1).ToString());
                    if (Menu.Item("usespell").GetValue<bool>() && Utils.SleepCheck("cooldown"))
                        SpellCast();
                    if (_creepTarget != null && _creepTarget.IsValid && _creepTarget.IsVisible && _creepTarget.IsAlive)
                    {
                        var time = _me.IsRanged == false
                        ? _aPoint * 2 / 1000 + _me.GetTurnTime(_creepTarget.Position)
                        : _aPoint * 2 / 1000 + _me.GetTurnTime(_creepTarget.Position) + _me.Distance2D(_creepTarget) / GetProjectileSpeed(_me);

                        var time2 = _me.IsRanged == false
                        ? _aPoint / 1000
                        : _aPoint / 1000 + _me.Distance2D(_creepTarget) / GetProjectileSpeed(_me);

                        var getDamage = GetDamageOnUnit(_creepTarget, Healthpredict(_creepTarget, time));
                        var getDamage2 = GetDamageOnUnit(_creepTarget, Healthpredict(_creepTarget, time2));
                        if (_creepTarget.Distance2D(_me) <= _attackRange && _creepTarget.Health < getDamage * 2)
                        {
                            if (_creepTarget.Health < getDamage ||
                                     (_creepTarget.Health < getDamage && _creepTarget.Team == _me.Team &&
                                      Menu.Item("denied").GetValue<bool>()))
                            {
                                if (!_me.IsAttacking())
                                    _me.Attack(_creepTarget);
                            }
                            else if (_creepTarget.Health < getDamage * 2 && _creepTarget.Health >= getDamage &&
                                _creepTarget.Team != _me.Team && Utils.SleepCheck("stop"))
                            {
                                _me.Hold();
                                _me.Attack(_creepTarget);
                                Utils.Sleep(_aPoint + Game.Ping, "stop");
                            }
                        }
                        else //if (_me.Distance2D(_creepTarget) >= _attackRange && Utils.SleepCheck("walk"))
开发者ID:nhochkaru,项目名称:EnsageSharp,代码行数:67,代码来源:LastHitSharp.cs


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