private void BuffTicker() { if (Buffs.Count == 0) { return; } for (int i = 0; i < Buffs.Count; i++) { Buff modded = new Buff { type = Buffs[i].type, percentage = Buffs[i].percentage, duration = Buffs[i].duration - 1.0f }; if (modded.duration <= 0.0f) { Buffs.RemoveAt(i); } else { Buffs[i] = modded; } } }
public override TreeNode ToTreeNode() { TreeNode root = base.ToTreeNode(); root.Nodes.Add("MovementSpeedType: " + MovementSpeedType); if (MovementPosition != null) { root.Nodes.Add("MovementPosition: " + MovementPosition); } root.Nodes.Add("MovementActionType: " + MovementActionType); root.Nodes.Add("LifeStateType: " + LifeStateType); root.Nodes.Add("MotionStateType: " + MotionStateType); root.Nodes.Add("GameStateType: " + GameStateType); root.Nodes.Add("SpeedWalking: " + SpeedWalking); root.Nodes.Add("SpeedRunning: " + SpeedRunning); root.Nodes.Add("SpeedBerserk: " + SpeedBerserk); // Buffs TreeNode buffs = new TreeNode("Buffs"); for (int i = 0; i < Buffs.Count; i++) { SRBuff buff = Buffs.GetAt(i); buffs.Nodes.Add(buff.Name); } root.Nodes.Add(buffs); root.Nodes.Add("unkByte01: " + unkByte01); root.Nodes.Add("unkByte02: " + unkByte02); return(root); }
// Reads the buff and quest information public override void Read(byte _version, BinaryReader _br) { base.Read(_version, _br); strMyName = _br.ReadString(); Buffs.Read(_br); QuestJournal = new QuestJournal(); QuestJournal.Read(_br); PatrolCoordinates.Clear(); String strPatrol = _br.ReadString(); foreach (String strPatrolPoint in strPatrol.Split(';')) { Vector3 temp = ModGeneralUtilities.StringToVector3(strPatrolPoint); if (temp != Vector3.zero) { PatrolCoordinates.Add(temp); } } String strGuardPosition = _br.ReadString(); GuardPosition = ModGeneralUtilities.StringToVector3(strGuardPosition); factionId = _br.ReadByte(); GuardLookPosition = ModGeneralUtilities.StringToVector3(_br.ReadString()); }
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale) { if (EntityUtilities.IsAnAlly(entityId, _damageSource.getEntityId())) { return(0); } if (EntityUtilities.GetBoolValue(entityId, "Invulnerable")) { return(0); } if (Buffs.HasBuff("buffInvulnerable")) { return(0); } // If we are being attacked, let the state machine know it can fight back emodel.avatarController.SetBool("IsBusy", false); // Turn off the trader ID while it deals damage to the entity ToggleTraderID(false); int Damage = base.DamageEntity(_damageSource, _strength, _criticalHit, _impulseScale); ToggleTraderID(true); return(Damage); }
public Effect(Buffs type, int duration) { this.Type = type; this.Duration = duration; this.ShootCount = 0; this.FrameCount = 0; }
public override void OnTick(EventArgs args) { if (!Menu["use" + Name].Cast <CheckBox>().CurrentValue || !IsReady()) { return; } foreach (var hero in Activator.Allies()) { if (hero.Player.NetworkId == Player.NetworkId) { if (Activator.cmenu[Parent.UniqueMenuId + "useon" + hero.Player.NetworkId] == null) { continue; } if (!Activator.cmenu[Parent.UniqueMenuId + "useon" + hero.Player.NetworkId].Cast <CheckBox>().CurrentValue) { continue; } Buffs.CheckDervish(hero.Player); if (hero.DervishBuffCount >= Menu["use" + Name + "number"].Cast <Slider>().CurrentValue&& hero.DervishHighestBuffTime >= Menu["use" + Name + "time"].Cast <Slider>().CurrentValue) { LeagueSharp.Common.Utility.DelayAction.Add(Game.Ping + Menu["use" + Name + "delay"].Cast <Slider>().CurrentValue, delegate { UseItem(Menu["mode" + Name].Cast <ComboBox>().CurrentValue == 1); hero.DervishBuffCount = 0; hero.DervishHighestBuffTime = 0; }); } } } }
public void AddBuff(Buff buff, bool can_stack) { if (BattleBase.Instance.IsBattleEnd == true) { return; } if (buff.IsMainBuff == true && can_stack == false) { foreach (Buff find_buff in Buffs.FindAll(b => b.Skill == buff.Skill)) { find_buff.Finish(); } } buff.EndTime = PlaybackTime + buff.Duration; buff.DoAction(); Buffs.Add(buff); // Buffs.Sort(Buff.SortByEndTime); if (buff.BuffContainer.Asset) { HPBar.AddBuff(buff.BuffContainer.Asset); } switch (buff.ActionInfo.actionType) { case eActionType.buff: case eActionType.debuff: case eActionType.buff_percent: case eActionType.debuff_percent: RefreshStat(); break; } }
private void StopAndRemoveBuff(Buff curentBuff) { if (curentBuff.BuffUsed) { ItemArrmor += curentBuff.MinusArmor; ItemArrmor -= curentBuff.Armor; OrijSpeed -= curentBuff.SpeedSlow; //Speed -= Buffs[i].SpeedSlow; // if (OrijAttackSpeed == AttackSpeed - Buffs[i].AttackSpeedSlow) ///Значит нет никаких воздействий на героя OrijAttackSpeed -= curentBuff.AttackSpeedSlow; OrijAttackSpeed += curentBuff.AttackSpeed; curentBuff.BuffUsed = false; } Buffs.Remove(curentBuff); ///Время действия бафа истекло if (!Buffs.Any(p => p.Stun)) ///Если на юнит не воздействуют другие станы { IsUnitStun = false; } UpdateView(); }
public void ReadFormationUnitData(BinaryReader br) { IsHero = br.ReadBoolean(); Rank = br.ReadInt32(); Team = (Team)br.ReadInt32(); int statusCount = br.ReadInt32(); Character.InitializeBasicStatuses(Statuses); for (int i = 0; i < statusCount; i++) { var savedStatusType = (StatusType)br.ReadInt32(); Statuses[savedStatusType].ReadStatusData(br); } if (IsHero) { RosterId = br.ReadInt32(); CurrentMode = br.ReadString(); } else { IsCorpse = br.ReadBoolean(); OriginalClass = br.ReadString(); Class = br.ReadString(); Name = br.ReadString(); CurrentHp = br.ReadSingle(); Buffs.Read(br); } CombatInfo = new FormationUnitInfo(); CombatInfo.ReadCombatInfoData(br); }
public void SetDamage(int damage, bool is_dot) { if (IsDead == true || BattleBase.Instance.IsBattleEnd == true) { return; } if (is_dot == false && IsSlept() == true) { var buffs = Buffs.Where(b => b.ActionInfo.actionType == eActionType.sleep).ToList(); foreach (var sleep in buffs) { sleep.Finish(); } } damage = Mathf.RoundToInt(damage * (1f - Stat.Stat.DecreaseDamagePercent * 0.0001f)); int set_hp = Stat.HP + damage; if (set_hp < 0 && IsWorldBoss == false) { set_hp = 0; } Stat.HP = set_hp; CheckDie(); }
public void WriteFormationUnitData(BinaryWriter bw) { bw.Write(IsHero); bw.Write(Rank); bw.Write((int)Team); bw.Write(Statuses.Count); foreach (var status in Statuses.Values) { bw.Write((int)status.Type); status.WriteStatusData(bw); } if (IsHero) { bw.Write(RosterId); bw.Write(CurrentMode); } else { bw.Write(IsCorpse); bw.Write(OriginalClass); bw.Write(Class); bw.Write(Name); bw.Write(CurrentHp); Buffs.Write(bw); } CombatInfo.WriteCombatInfoData(bw); }
public void ApplyAuraJson(JToken json, bool buffs) { if (buffs) { lock (Buffs) { Buffs.Clear(); foreach (var auraJson in json.Children()) { var aura = new WoWAura(); aura.ApplyJson(auraJson); Buffs.Add(aura); } } } else { lock (Debuffs) { Debuffs.Clear(); foreach (var auraJson in json.Children()) { var aura = new WoWAura(); aura.ApplyJson(auraJson); Debuffs.Add(aura); } } } }
public override Packet GetInfoPacket(PlayerObject ob) { return(new S.ObjectMonster { ObjectID = ObjectID, MonsterIndex = MonsterInfo.Index, Location = CurrentLocation, NameColour = NameColour, Direction = Direction, Dead = Dead, PetOwner = PetOwner?.Name, Skeleton = NeedHarvest && Skeleton && (Drops == null || !Drops.ContainsKey(ob.Character.Account)), Poison = Poison, EasterEvent = EasterEventMob, HalloweenEvent = HalloweenEventMob, ChristmasEvent = ChristmasEventMob, ExtraInt = Stage, Buffs = Buffs.Where(x => x.Visible).Select(x => x.Type).ToList() }); }
public void TakeObject(CollectableObject collectableObject) { if (!collectableObject.ObjectTaken) { int i = 0; while (i < Inventory.Length && Inventory[i] != null) { i++; } if (i < Inventory.Length) { Inventory[i] = collectableObject; if (collectableObject.BuffObject != null) { Buffs.Add(collectableObject.BuffObject); } collectableObject.ObjectTaken = true; collectableObject.TakeObjectAnimation(); } else { print("Inventory full"); } } }
/// <summary> /// Update the observable collections /// </summary> public void UpdateInventoryCategories() { Treasures.Clear(); Gems.Clear(); ArmorSet.Clear(); Buffs.Clear(); foreach (var gameItemQuantity in _inventory) { if (gameItemQuantity.GameItem is Treasure) { Treasures.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Gem) { Gems.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is ArmorSet) { ArmorSet.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Buff) { Buffs.Add(gameItemQuantity); } } }
/// <summary> /// Remove a Buff from the Monster /// </summary> /// <param name="buff">The buff to remove</param> /// <returns>Whether or not the Buff existed before removal</returns> public bool RemoveBuff(Buff buff) { bool retBool = Buffs.ContainsKey(buff); Buffs.Remove(buff); return(retBool); }
public bool HasBuff(BuffType type) { lock (Buffs) { return(Buffs.Any(s => s.Card.BuffType == type)); } }
public void GetAward(IUnit killedUnit) { this.Exp += killedUnit.NExp; int gold = 0; Player killedPlayer = killedUnit as Player; if (killedPlayer != null) { gold += killedPlayer.Level * StaticVaribl.PlayerGoldPlus; } else { gold += killedUnit.NGold; } Buff buff = Buffs.FirstOrDefault(p => p.Name == "GreevilsGreed"); if (buff != null) { gold += buff.GoldBonus; } this.Gold += gold; StatisticData.AllGold += gold; this.UpdateView(); }
public IEnumerable <AttributeBuff> GetBuffs(Buff.Category category, string name) { return(Buffs .Where(x => x.Category == category) .Where(x => string.IsNullOrEmpty(name) || string.IsNullOrEmpty(x.Name) || x.Name == name) .Select(x => new AttributeBuff(x.AttributeID, x.Mode, x.Value))); }
/// <summary> /// Properly updates the QSS buff count /// </summary> /// <param name="player"></param> internal static void CheckQSS(AIHeroClient player) { foreach (var hero in Activator.Heroes.Where(x => x.Player.NetworkId == player.NetworkId)) { hero.QSSBuffCount = Buffs.GetAuras(hero.Player, "Quicksilver").Count(); if (hero.QSSBuffCount > 0) { foreach (var buff in Buffs.GetAuras(hero.Player, "Quicksilver")) { var duration = (int)(buff.EndTime - buff.StartTime); if (duration > hero.QSSHighestBuffTime) { hero.QSSHighestBuffTime = duration * 1000; } } hero.LastDebuffTimestamp = Utils.GameTimeTickCount; } else { if (hero.QSSHighestBuffTime > 0) { hero.QSSHighestBuffTime -= hero.QSSHighestBuffTime; } else { hero.QSSHighestBuffTime = 0; } } } }
/// <summary> /// Update the observable collections /// </summary> public void UpdateInventoryCategories() { Soldiers.Clear(); SeigeWeapons.Clear(); Treasures.Clear(); Buffs.Clear(); foreach (var gameItemQuantity in _inventory) { if (gameItemQuantity.GameItem is Soldier) { Soldiers.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is SeigeWeapon) { SeigeWeapons.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Treasure) { Treasures.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Buff) { Buffs.Add(gameItemQuantity); } } }
public override void PostInit() { base.PostInit(); // disable god mode, since that's enabled by default in the NPC IsGodMode.Value = false; if (NPCInfo != null) { DefaultTraderID = NPCInfo.TraderID; } InvokeRepeating("DisplayStats", 0f, 60f); // Check if there's a loot container or not already attached to store its stuff. DisplayLog(" Checking Entity's Loot Container"); if (lootContainer == null) { DisplayLog(" Entity does not have a loot container. Creating one."); int lootList = GetLootList(); DisplayLog(" Loot list is: " + lootList); lootContainer = new TileEntityLootContainer(null); lootContainer.entityId = entityId; lootContainer.SetContainerSize(new Vector2i(8, 6), true); // If the loot list is available, set the container to that size. if (lootList != 0) { lootContainer.SetContainerSize(LootContainer.lootList[lootList].size, true); } } Buffs.SetCustomVar("$waterStaminaRegenAmount", 0, false); }
public void LoadData(List <string> data) { for (int i = 1; i < data.Count; i++) { switch (data[i]) { case ".buffs": while (++i < data.Count && data[i--][0] != '.') { Buffs.Add(data[++i]); } break; case ".recovery_buffs": while (++i < data.Count && data[i--][0] != '.') { RecoveryBuffs.Add(data[++i]); } break; case ".recovery_heart_attack_buffs": while (++i < data.Count && data[i--][0] != '.') { RecoveryHeartAttackBuffs.Add(data[++i]); } break; default: Debug.LogError("Unexpected token in death door: " + data[i]); break; } } }
public override void OnUpdateLive() { if (lastDoorOpen != Vector3i.zero) { OpenDoor(); } Buffs.RemoveBuff("buffnewbiecoat", false); Stats.Health.MaxModifier = Stats.Health.Max; // Non-player entities don't fire all the buffs or stats, so we'll manually fire the water tick, Stats.Water.Tick(0.5f, 0, false); // then fire the updatestats over time, which is protected from a IsPlayer check in the base onUpdateLive(). Stats.UpdateStatsOverTime(0.5f); updateTime = Time.time - 2f; base.OnUpdateLive(); // Check if there's a player within 10 meters of us. If not, resume wandering. emodel.avatarController.SetBool("IsBusy", false); if (!SingletonMonoBehaviour <ConnectionManager> .Instance.IsServer) { return; } if (GetAttackTarget() == null || GetRevengeTarget() == null) { if (this is EntityAliveFarmingAnimalSDX) { return; } List <global::Entity> entitiesInBounds = GameManager.Instance.World.GetEntitiesInBounds(this, new Bounds(position, Vector3.one * 5f)); if (entitiesInBounds.Count > 0) { for (int i = 0; i < entitiesInBounds.Count; i++) { if (entitiesInBounds[i] is EntityPlayer) { if (GetDistance(entitiesInBounds[i]) > 1) { emodel.avatarController.SetBool("IsBusy", true); SetLookPosition(entitiesInBounds[i].getHeadPosition()); RotateTo(entitiesInBounds[i], 30f, 30f); break; } else { moveHelper.SetMoveTo((entitiesInBounds[i] as EntityPlayer).GetLookVector(), false); } } } } } }
public void RemoveObject(CollectableObject collectableObject) { if (collectableObject.BuffObject != null) { Buffs.Remove(collectableObject.BuffObject); } }
public new void SetRevengeTarget(EntityAlive _other) { if (_other) { // Forgive friendly fire, even from explosions. EntityAlive myLeader = EntityUtilities.GetLeaderOrOwner(entityId) as EntityAlive; if (myLeader) { if (myLeader.entityId == _other.entityId) { return; } } if (EntityUtilities.IsAnAlly(entityId, _other.entityId)) { return; } if (_other.IsDead()) { return; } } base.SetRevengeTarget(_other); // Debug.Log("Adding Buff for RevengeTarget() "); Buffs.AddBuff("buffNotifyTeamAttack", -1, true); }
public void WhatBuff(Consumable consumable) { switch (consumable.buff) { case Buffs.ManaRegen: buff = Buffs.ManaRegen; ManaRegen(consumable.grade); break; case Buffs.HealthRegen: buff = Buffs.HealthRegen; HealthRegen(consumable.grade); break; case Buffs.CelerityBuff: buff = Buffs.CelerityBuff; CelerityBuff(consumable.grade); break; case Buffs.CooldownBuff: buff = Buffs.CooldownBuff; CooldownBuff(consumable.grade); break; case Buffs.SpeedBuff: buff = Buffs.SpeedBuff; SpeedBuff(consumable.grade); break; } }
/// <summary> /// Properly updates the Mercurial buff count /// </summary> /// <param name="player"></param> internal static void CheckMercurial(Obj_AI_Hero player) { foreach (var hero in Activator.Heroes.Where(x => x.Player.NetworkId == player.NetworkId)) { hero.MercurialBuffCount = Buffs.GetAuras(hero.Player, "Mercurial").Count(); if (hero.MercurialBuffCount > 0) { foreach (var buff in Buffs.GetAuras(hero.Player, "Mercurial")) { var duration = (int)(buff.EndTime - buff.StartTime); if (duration > hero.MercurialHighestBuffTime) { hero.MercurialHighestBuffTime = duration * 1000; } } hero.LastDebuffTimestamp = Utils.GameTimeTickCount; } else { if (hero.MercurialHighestBuffTime > 0) { hero.MercurialHighestBuffTime -= hero.MercurialHighestBuffTime; } else { hero.MercurialHighestBuffTime = 0; } } } }
public override Packet GetInfoPacket(PlayerObject ob) { return(new S.ObjectMonster { ObjectID = ObjectID, MonsterIndex = MonsterInfo.Index, Location = CurrentLocation, NameColour = NameColour, Direction = Direction, PetOwner = CompanionOwner.Name, Poison = Poison, Buffs = Buffs.Where(x => x.Visible).Select(x => x.Type).ToList(), CompanionObject = new ClientCompanionObject { Name = UserCompanion.Name, HeadShape = HeadShape, BackShape = BackShape, } }); }
public void RemoveBuff(string b) { lock (BuffsLock) { Buffs.Remove(b); } }
public ZoneCharacter(string name, bool loadequips = true) { try { character = Program.Entity.Characters.First(c => c.Name == name); if (character == null) throw new Exception("Character not found."); Program.Entity.Refresh(System.Data.Objects.RefreshMode.StoreWins, character); //fixes changes when character is offline Buffs = new Buffs(this); LastShout = Program.CurrentTime; ChatBlocked = DateTime.MinValue; NextSPRest = DateTime.MaxValue; NextHPRest = DateTime.MaxValue; SelectedObject = null; House = null; HP = (uint)character.HP; //we copy these to make less stress on Entity SP = (uint)character.SP; Exp = character.Exp; StonesHP = character.HPStones; StonesSP = character.SPStones; State = PlayerState.Normal; LoadItems(); if (IsDead) { HP = MaxHP / 4; Exp = Exp / 2; MapInfo mi; DataProvider.Instance.MapsByID.TryGetValue(MapID, out mi); if (mi != null) { character.XPos = mi.RegenX; character.YPos = mi.RegenY; } } SetMap(MapID); } catch (Exception ex) { Log.WriteLine(LogLevel.Exception, "Error reading character from entity: {0}", ex.ToString()); } }