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


C# Unit.FindModifier方法代码示例

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


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

示例1: UpdateData

 public void UpdateData(Unit unit)
 {
     Unit = unit;
     var duration = unit.FindModifier("modifier_techies_remote_mine")?.RemainingTime;
     if (duration != null)
     {
         Duration = duration.Value;
         EndTime = Game.RawGameTime + Duration;
     }
     RequiresUpdate = false;
     Handle = unit.Handle;
 }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:12,代码来源:RemoteMine.cs

示例2: RemoteMine

 public RemoteMine(Unit unit)
     : base(unit, AbilityName)
 {
     Duration = unit.FindModifier("modifier_techies_remote_mine")?.RemainingTime
                ?? Ability.GetAbilityDataByName(AbilityName)
                    .AbilitySpecialData.First(x => x.Name == "duration")
                    .Value;
     if (Menu.RangeEnabled(AbilityName))
     {
         ParticleEffect = new ParticleEffect("particles/ui_mouseactions/drag_selected_ring.vpcf", unit.Position);
     }
     Initialize();
 }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:13,代码来源:RemoteMine.cs

示例3: Ward

 protected Ward(Unit unit, string abilityName)
 {
     Unit = unit;
     Position = unit.Position;
     Duration = unit.FindModifier("modifier_item_buff_ward").RemainingTime;
     EndTime = Game.RawGameTime + Duration;
     RequiresUpdate = false;
     Handle = unit.Handle;
     TextureSize = new Vector2(50, 35);
     if (Menu.RangeEnabled(abilityName))
     {
         ParticleEffect = new ParticleEffect("particles/ui_mouseactions/drag_selected_ring.vpcf", Position);
     }
 }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:14,代码来源:Ward.cs

示例4: Cast

        public static bool Cast(Ability ability, Unit target, string name)
        {
            if (name == "pudge_rot" && Utils.SleepCheck("rotToggle"))
            {
                if (!ability.IsToggled)
                {
                    ability.ToggleAbility();
                    Utils.Sleep(500, "rotToggle");
                    return true;
                }

                return false;
            }

            if (name == "templar_assassin_psionic_trap")
            {
                var modifier = target.FindModifier("modifier_templar_assassin_trap_slow");
                if (modifier != null && modifier.RemainingTime > ability.GetHitDelay(target, name))
                {
                    return false;
                }

                if (TemplarAssasinUseTrap(target))
                {
                    return false;
                }

                var casted = ability.CastSkillShot(target, MyHeroInfo.Position, name);
                if (casted)
                {
                    DelayAction.Add(
                        new DelayActionItem(
                            (int)ability.GetHitDelay(target, name) * 1000 + 700, 
                            delegate { TemplarAssasinUseTrap(target); }, 
                            CancellationToken.None));
                }

                return casted;
            }

            return ability.CastStun(
                target, 
                1, 
                abilityName: name, 
                soulRing: SoulRing.Check(ability) ? MyAbilities.SoulRing : null);
        }
开发者ID:Ray0fHope,项目名称:EnsageSharp,代码行数:46,代码来源:Slow.cs

示例5: StasisTrap

 public StasisTrap(Unit unit)
     : base(unit, AbilityName)
 {
     PositionCorrection = new Vector2(25);
     Radius =
         Ability.GetAbilityDataByName(AbilityName)
             .AbilitySpecialData.First(x => x.Name == "activation_radius")
             .Value;
     Duration = unit.FindModifier("modifier_techies_stasis_trap")?.RemainingTime ?? 600;
     //Ability.GetAbilityDataByName(AbilityName)
     //    .AbilitySpecialData.First(x => x.Name == "duration")
     //    .Value;
     EndTime = Game.RawGameTime + Duration;
     showTimer = Menu.TimerEnabled(AbilityName);
     if (ParticleEffect != null)
     {
         ParticleEffect.SetControlPoint(1, new Vector3(65, 105, 225));
         ParticleEffect.SetControlPoint(2, new Vector3(Radius, 255, 0));
     }
 }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:20,代码来源:StasisTrap.cs

示例6: UpdateData

 public virtual void UpdateData(Unit unit)
 {
     Unit = unit;
     Position = unit.Position;
     Duration = unit.FindModifier("modifier_item_buff_ward").RemainingTime;
     EndTime = Game.RawGameTime + Duration;
     RequiresUpdate = false;
     Handle = unit.Handle;
 }
开发者ID:IdcNoob,项目名称:Ensage,代码行数:9,代码来源:Ward.cs

示例7: CalculateDamage


//.........这里部分代码省略.........
                    }

                    var minusArmors = new[] { -2, -4, -6, -8 };
                    var meldminusArmor = target.Armor + minusArmors[level - 1];
                    var damageIncrease = 1 - 0.06 * meldminusArmor / (1 + 0.06 * Math.Abs(meldminusArmor));
                    outgoingDamage =
                        (float)
                        (target.SpellDamageTaken(
                            source.MaximumDamage + source.BonusDamage, 
                            DamageType.Physical, 
                            source, 
                            name, 
                            data.MagicImmunityPierce, 
                            minusMagicResistancePerc: minusMagicResistancePerc) + bonusDamage * damageIncrease);
                    break;
                case "undying_decay":
                    var strengthSteal = ability.GetAbilityData("str_steal");
                    if (source.AghanimState())
                    {
                        strengthSteal = ability.GetAbilityData("str_Steal_scepter");
                    }

                    outgoingDamage = strengthSteal * 19
                                     + target.SpellDamageTaken(
                                         ability.GetAbilityData(data.DamageString), 
                                         DamageType.Magical, 
                                         source, 
                                         name, 
                                         false, 
                                         minusMagicResistancePerc: minusMagicResistancePerc);
                    break;
                case "visage_soul_assumption":
                    var dmg = ability.GetAbilityData(data.DamageString);
                    var modif = source.FindModifier("modifier_visage_soul_assumption");
                    if (modif != null)
                    {
                        dmg += modif.StackCount * ability.GetAbilityData("soul_charge_damage");
                    }

                    outgoingDamage = target.SpellDamageTaken(
                        dmg, 
                        DamageType.Magical, 
                        source, 
                        name, 
                        false, 
                        minusMagicResistancePerc: minusMagicResistancePerc);
                    break;
                case "morphling_adaptive_strike":
                    if (!damageDictionary.TryGetValue(ability, out bonusDamage))
                    {
                        bonusDamage = ability.GetAbilityData(data.DamageString);
                        damageDictionary.Add(ability, bonusDamage);
                        levelDictionary.Add(ability, level);
                    }
                    else if (levelDictionary[ability] != level)
                    {
                        levelDictionary[ability] = level;
                        bonusDamage = ability.GetAbilityData(data.DamageString);
                        damageDictionary[ability] = bonusDamage;
                    }

                    hero = source as Hero;
                    var agi = Math.Floor(hero.TotalAgility);
                    var str = Math.Floor(hero.TotalStrength);
                    var difference = agi / str;
                    var multimin = ability.GetAbilityData("damage_min");
开发者ID:EnsageSharp,项目名称:Ensage.Common,代码行数:67,代码来源:AbilityDamage.cs

示例8: DoShit

        /**
        * DoShit takes in a unit and makes the unit do pushing related actions:
        * 1) boots of travel to creep furthest away from unit
        * 2) push the current lane
        * 3) attack tower with shield if nearby
        * 4) attack creeps if nearby
        * 5) if enemy creeps are nearby, use mjollnir and necronomicon
        * args hero: unit to control
        * args isTempest: passed to easily distinguish between clone unit and other units
        **/
        private static void DoShit(Unit hero, bool isTempest=false)
        {
            if (!hero.IsAlive)
                return;
            // setting variables
            var handle = hero.Handle;
            var items = isTempest ? hero.Inventory.Items.ToList() : null;
            var travelBoots = isTempest?
                items.FirstOrDefault(
                    x =>
                        (x.Name == "item_travel_boots" ||
                         x.Name == "item_travel_boots_2") && x.CanBeCasted() &&
                        Utils.SleepCheck("Tempest.Travels.Cd" + handle)) : null;
            var autoPushItems =isTempest ?
                items.Where(
                    x =>
                        AutoPushItems.Contains(x.Name) && x.CanBeCasted() &&
                        Utils.SleepCheck("Tempest.AutoPush.Cd" + handle + x.Name)) : null;
            var myCreeps = Objects.LaneCreeps.GetCreeps().Where(x => x.Team == hero.Team).ToList();
            var enemyCreeps = Objects.LaneCreeps.GetCreeps().Where(x => x.Team != hero.Team).ToList();
            var creepWithEnemy =
                myCreeps.FirstOrDefault(
                    x => x.MaximumHealth * 65 / 100 < x.Health && enemyCreeps.Any(y => y.Distance2D(x) <= 1000));
            var isChannel = isTempest && hero.IsChanneling();

            // code for using boots of travel
            // note: chooses creep furthest away from unit to TP to
            if (travelBoots != null && !enemyCreeps.Any(x => x.Distance2D(hero) <= 1000) && !isChannel && Menu.Item("AutoPush.Travels").GetValue<bool>())
            {
                var mod = hero.FindModifier("modifier_kill");
                if (mod == null || mod.RemainingTime >= 10)
                {
                    if (creepWithEnemy == null)
                    {
                        creepWithEnemy = myCreeps.OrderByDescending(x => x.Distance2D(hero)).FirstOrDefault();
                    }
                    if (creepWithEnemy != null)
                    {
                        travelBoots.UseAbility(creepWithEnemy);
                        Utils.Sleep(500, "Tempest.Travels.Cd" + handle);
                        return;
                    }
                }
            }
            if (isChannel) return;

            var nearestTower =
                Objects.Towers.GetTowers()
                    .Where(x => x.Team == hero.GetEnemyTeam())
                    .OrderBy(y => y.Distance2D(hero))
                    .FirstOrDefault() ?? Objects.Fountains.GetEnemyFountain();
            var fountain = Objects.Fountains.GetAllyFountain();
            var curlane = GetCurrentLane(hero);
            var clospoint = GetClosestPoint(curlane);
            var useThisShit = clospoint.Distance2D(fountain) - 250 > hero.Distance2D(fountain);
            // useThisShit will return true if unit is closer to the fountain than the clospoint

            if (nearestTower != null)
            {
                var pos = (curlane == "mid" || !useThisShit) ? nearestTower.Position : clospoint;
                // if unit is at mid or clospoint is closer than the unit to the fountain, push the nearest tower
                // otherwise, push the closest point

                // if unit is a tempest and is close to the tower, use shield and attack tower
                if (nearestTower.Distance2D(hero) <= 900 && isTempest)
                {
                    if (Utils.SleepCheck("Tempest.Attack.Tower.Cd" + handle))
                    {
                        var spell = hero.Spellbook.Spell2;
                        if (spell != null && IsAbilityEnable(spell.StoredName(), calcForPushing: true) &&
                            spell.CanBeCasted() && Utils.SleepCheck("shield" + handle))
                            // handle used to uniquely identify the current hero's cooldowns
                        {
                            spell.UseAbility(Prediction.InFront(hero, 100));
                            Utils.Sleep(1500, "shield" + handle);
                        }
                        else if (!hero.IsAttacking())
                        {
                            hero.Attack(nearestTower);
                        }
                        Utils.Sleep(1000, "Tempest.Attack.Tower.Cd" + handle);
                    }
                }
                // make the unit issue an attack command at the position pos
                else if (Utils.SleepCheck("Tempest.Attack.Cd" + handle) && !hero.IsAttacking() && isTempest)
                {
                    hero.Attack(pos);
                    Utils.Sleep(1000, "Tempest.Attack.Cd" + handle);
                }
                // smart attack for necrobook (unaggro under tower)
//.........这里部分代码省略.........
开发者ID:JumpAttacker,项目名称:EnsageSharp,代码行数:101,代码来源:Core.cs


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