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"); } } }
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 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; } }
// ------------------ /// <summary> /// Attacking unit calls Defend method on defending unit. /// </summary> protected virtual void Defend(Unit other, int dealtDamage) { MarkAsDefending(other); int receivedDamage = (int)Mathf.Floor(dealtDamage / DefenceFactor); HitPoints -= receivedDamage; printDamage(receivedDamage + 1); if (other.Buffs.Find(b => b.Name == "Snake Venom") != null) { SnakeDot sndot = new SnakeDot(); Buffs.Add(sndot); } if (UnitAttacked != null) { UnitAttacked.Invoke(this, new AttackEventArgs(other, this, receivedDamage)); } if (HitPoints <= 0) { if (UnitDestroyed != null) { UnitDestroyed.Invoke(this, new AttackEventArgs(other, this, receivedDamage)); } OnDestroyed(); } }
public static void Init() { var Hgcolor = ColorCatalog.ColorIndex.LunarItem; if (!Hbdbt.Value) { Hgcolor = ColorCatalog.ColorIndex.Equipment; } AddTokens(); HerGamble = ScriptableObject.CreateInstance <EquipmentDef>(); HerGamble.name = "HERGAMBLE"; HerGamble.nameToken = "Her Gamble"; HerGamble.pickupToken = HERGAMBLE_PICKUP; HerGamble.descriptionToken = HERGAMBLE_DESC; HerGamble.loreToken = HERGAMBLE_LORE; HerGamble.isLunar = Hbdbt.Value; HerGamble.colorIndex = Hgcolor; HerGamble.pickupIconSprite = Her_Burden.bundle.LoadAsset <Sprite>(Hbiiv.Value + "ItemIcon"); HerGamble.pickupModelPrefab = Her_Burden.bundle.LoadAsset <GameObject>("her_gamble"); HerGamble.canDrop = true; HerGamble.cooldown = 60f; ExperimentalBuff = ScriptableObject.CreateInstance <BuffDef>(); ExperimentalBuff.name = "ExperimentalBuff"; ExperimentalBuff.iconSprite = Her_Burden.bundle.LoadAsset <Sprite>(Hbiiv.Value + "ItemIcon"); Buffs.Add(ExperimentalBuff); ExperimentalDeBuff = ScriptableObject.CreateInstance <BuffDef>(); ExperimentalDeBuff.name = "ExperimentalDeBuff"; ExperimentalDeBuff.iconSprite = Her_Burden.bundle.LoadAsset <Sprite>(Hbiiv.Value + "ItemIcon"); Buffs.Add(ExperimentalDeBuff); AddLocation(); }
/// <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 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); } } } }
/// <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); } } }
public IBuff GetAbilityBuffFromName(string name) { var abilitybuff = AbilityBuffs.Find(b => b.Name == name && b is AbilityBuff); // Shameful add to Buffs list to keep other stuff working for now Buffs.Add(abilitybuff); return(abilitybuff); }
/// <summary> /// 为这个道路增加一个增益 /// </summary> /// <param name="buff">要增加的增益</param> public virtual void AddBuff(RoadBuff buff) { if (buff == null) { throw new ArgumentNullException(nameof(buff)); } Buffs.Add(buff); }
public void AddBuff(StockBuff buff) { if (buff == null) { throw new ArgumentNullException(nameof(buff)); } Buffs.Add(buff); }
public void WorriorBuff(int teamSoldierId) { Util.Abstract.Soldier teamSoldier = _player.GetSoldiers().Where(s => s.Id == teamSoldierId).ElementAt(0);; WarCryBuff warCryBuff = new WarCryBuff(); warCryBuff.DoBuff(teamSoldier); Buffs.Add(warCryBuff); EndOfTurnAction(); }
public void HunterBuff(int teamSoldierId) { Util.Abstract.Soldier teamSoldier = _player.GetSoldiers().Where(s => s.Id == teamSoldierId).ElementAt(0); ArcherBuff buff = new ArcherBuff(); buff.DoBuff(teamSoldier); Buffs.Add(buff); EndOfTurnAction(); }
public void AddBuff(Buff.Buff indicator) { if (indicator?.Card == null || indicator.Card.BuffType == BuffType.Bad && Buffs.Any(b => b.Card.CardId == indicator.Card.CardId)) { return; } Buffs.RemoveWhere(s => !s.Card.CardId.Equals(indicator.Card.CardId), out ConcurrentBag <Buff.Buff> buffs); Buffs = buffs; //TODO: Find a better way to do this int randomTime = 0; if (Session is Character character) { if (indicator.Card.CardId == 85) { randomTime = character.BuffRandomTime = ServerManager.Instance.RandomNumber(50, 350); } else if (indicator.Card.CardId == 336) { randomTime = character.BuffRandomTime = ServerManager.Instance.RandomNumber(30, 70); } else if (indicator.Card.CardId == 0) { character.BuffRandomTime = character.ChargeValue > 7000 ? 7000 : character.ChargeValue; } if (!indicator.StaticBuff) { character.Session.SendPacket($"bf 1 {character.CharacterId} {(character.ChargeValue > 7000 ? 7000 : character.ChargeValue)}.{indicator.Card.CardId}.{indicator.Card.Duration} {Level}"); character.Session.SendPacket(character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("UNDER_EFFECT"), indicator.Card.Name), 20)); } } if (!indicator.StaticBuff) { indicator.RemainingTime = indicator.Card.Duration == 0 ? randomTime : indicator.Card.Duration; indicator.Start = DateTime.Now; } Buffs.Add(indicator); indicator.Card.BCards.ForEach(c => c.ApplyBCards(Entity)); if (indicator.Card.EffectId > 0) { //Entity.MapInstance?.Broadcast(Entity.GenerateEff(indicator.Card.EffectId)); } if (ObservableBag.TryGetValue(indicator.Card.CardId, out IDisposable value)) { value?.Dispose(); } ObservableBag[indicator.Card.CardId] = Observable.Timer(TimeSpan.FromMilliseconds(indicator.RemainingTime * (indicator.StaticBuff ? 1000 : 100))).Subscribe(o => { RemoveBuff(indicator.Card.CardId); if (indicator.Card.TimeoutBuff != 0 && ServerManager.Instance.RandomNumber() < indicator.Card.TimeoutBuffChance) { AddBuff(new Buff.Buff(indicator.Card.TimeoutBuff, Level)); } }); }
public bool AddBuff(BuffFacade b, bool IsApply = true) { Buffs.Add(b); Buffed.Add(false); if (IsApply) { return(CalculateBuff(Buffed.Count - 1)); } return(true); }
public void AddBuff(Buff buff) { if (!Buffs.Contains(buff)) { Buffs.Add(buff); if (components.pokemon.networkID == DarkRiftAPI.id) { components.pokemon.hud.playerPokemonPortrait.SpawnBuffIcon(buff); } } }
public void RemoveBuff(IBuff b) { lock (_buffsLock) { if (b.BuffAddType == BuffAddType.STACKS_AND_OVERLAPS && b.StackCount > 1) { b.DecrementStackCount(); RemoveBuff(b.Name); BuffList.Remove(b); RemoveBuffSlot(b); var tempbuffs = GetBuffsWithName(b.Name); tempbuffs.ForEach(tempbuff => tempbuff.SetStacks(b.StackCount)); BuffSlots[b.Slot] = tempbuffs[0]; Buffs.Add(b.Name, tempbuffs[0]); var newestBuff = tempbuffs[tempbuffs.Count - 1]; if (!b.IsHidden) { if (b.BuffType == BuffType.COUNTER) { _game.PacketNotifier.NotifyNPC_BuffUpdateNumCounter(Buffs[b.Name]); } else { if (b.StackCount == 1) { _game.PacketNotifier.NotifyNPC_BuffUpdateCount(newestBuff, b.Duration - newestBuff.TimeElapsed, newestBuff.TimeElapsed); } else { _game.PacketNotifier.NotifyNPC_BuffUpdateCountGroup(this, tempbuffs, b.Duration - newestBuff.TimeElapsed, newestBuff.TimeElapsed); } } } } else { BuffList.RemoveAll(buff => buff.Elapsed()); RemoveBuff(b.Name); RemoveBuffSlot(b); if (!b.IsHidden) { _game.PacketNotifier.NotifyNPC_BuffRemove2(b); } } } }
public void AddBuff(IBuff b) { lock (BuffsLock) { if (!Buffs.ContainsKey(b.Name)) { Buffs.Add(b.Name, b); } else { Buffs[b.Name].ResetDuration(); // if buff already exists, just restart its timer } } }
public void Defenderse() { if (!defenderseUsado) { var buff = new DefenceBuff(1, 2); buff.Apply(this); Buffs.Add(buff); Debug.Log("Buffo de defenderse usado"); defenderse.gameObject.SetActive(false); defenderseUsado = true; MovementPoints = 0; ActionPoints = 0; } }
/// <summary> /// This is triggered when the button is clicked. /// </summary> private void TriggerSpecialAbility() { //Hero has specail ability that allows him to raise his attack by 2 for duration of 3 turns. //This ability can be triggered once a game. if (!_abilityUsed) { _abilityUsed = true; var buff = new AttackBuff(3, 2); buff.Apply(this); Buffs.Add(buff); _specialAbilityButton.gameObject.SetActive(false); } }
public void AddBuff(Buff b) { lock (BuffsLock) { if (!Buffs.ContainsKey(b.Name)) { Buffs.Add(b.Name, b); } else { Buffs[b.Name].TimeElapsed = 0; // if buff already exists, just restart its timer } } }
public void AddBuff(Buff buff) { if (Buffs.Where((Buff f) => f.Type == buff.Type).Count() == 0) { Buffs.Add(buff); } else { Buff x = Buffs.Where((Buff f) => f.Type == buff.Type).First(); if (x.LastedTime < buff.LastedTime) { x.LastedTime = buff.LastedTime; } } }
//Buffs private void CreateInvincibility() { var buff = new Buff(true, Time.time + 0.5f); buff.EffectMethod = () => { buff.IsAffected = buff.Duration >= Time.time; GetComponent <SpriteRenderer>().color = buff.IsAffected ? _invincibleColor : Color.Lerp(Color.black, EnemyInfo.BaseColor, CurrentHealth / MaxHealth); return(0f); }; Buffs.Add(BuffType.Invinciblity, buff); }
public void AddBuff(Buff newBuff) { bool found = false; foreach (var buff in Buffs) { if (buff.BuffId == newBuff.BuffId) { buff.BuffLifetime = newBuff.BuffLifetime; found = true; } } if (!found) { Buffs.Add(newBuff); } }
public override bool Response(ref ShareLotteryPlanClass optPlan) { optPlan = null; if (currPlan != null) { optPlan = currPlan; } if (currPlan == null) { answerMsg(optPlan == null ? "本群目前没有合买" : null); return(false); } if (currPlan.creator != requestUser) { answerMsg(string.Format("本次合买由{0}创建,您没有修改权限!", currPlan.creatorNike)); return(false); } currstatus = currPlan.sharePlanStatus; if (changeToStatus == currstatus) { answerMsg(string.Format("状态{0}!", newStatusName)); return(false); } if (((int)changeToStatus - (int)currstatus) > 1 && changeToStatus != SharePlanStatus.Completed) { answerMsg(string.Format("除非关闭合买,否则合买状态不能越级操作!")); return(false); } if (updateVals != null) { Buffs.Add(updateVals); } TheAskWaitingUserAnswer ask = new TheAskWaitingUserAnswer(this); ask.askData = MutliLevelData.createAValidateSubmitData("1", "确定", "0", "取消"); ask.askMsg = string.Format(@"请确定将合买状态修改为{0}! {1}", newStatusName, ask.AskText); wxprocess.InjectAsk(ask); answerMsg(ask.askMsg); return(false); }
public void Read(BinaryStreamReader reader) { var count = reader.ReadInt32(); Buffs.Clear(); for (var i = 0; i < count; i++) { var name = reader.ReadString(); var categoryAndId = (Buff.CategoryAndID)reader.ReadInt32(); var mode = (AttributeBuffMode)reader.ReadInt32(); var value = reader.ReadInt32(); Buffs.Add(new AttributeBuffWrapper { Name = name, AttributeID = Buff.AttributeIDFromBuffCategoryAndID(categoryAndId), Category = Buff.CategoryFromBuffCategoryAndID(categoryAndId), Mode = mode, Value = value, }); } }
public override void Initialize() { Class = GetDropDown("Class"); Aimsharp.PrintMessage("Arena Interrupts Plugin"); Aimsharp.PrintMessage("This plugin will only work inside arenas!"); Aimsharp.PrintMessage("Do not use this together with the normal Kicks plugin!"); Aimsharp.PrintMessage("Use this macro to hold your kicks for a number of seconds: /xxxxx SaveKicks #"); Aimsharp.PrintMessage("For example: /xxxxx SaveKicks 5"); Aimsharp.PrintMessage("will make the bot not kick anything for the next 5 seconds."); if (Class == "Hunter") { Interrupts.Add("Counter Shot"); } if (Class == "Rogue") { Interrupts.Add("Kick"); } if (Class == "Priest") { Interrupts.Add("Silence"); } if (Class == "Demon Hunter") { Interrupts.Add("Disrupt"); } if (Class == "Shaman") { Interrupts.Add("Wind Shear"); Specials.Add("Grounding Totem"); Specials.Add("Lightning Lasso"); } if (Class == "Paladin") { Interrupts.Add("Rebuke"); } if (Class == "Death Knight") { Interrupts.Add("Mind Freeze"); } if (Class == "Druid") { Interrupts.Add("Skull Bash"); Interrupts.Add("Solar Beam"); } if (Class == "Warlock") { Interrupts.Add("Spell Lock"); Specials.Add("Mortal Coil"); } if (Class == "Mage") { Interrupts.Add("Counterspell"); } if (Class == "Monk") { Interrupts.Add("Spear Hand Strike"); } if (Class == "Warrior") { Interrupts.Add("Pummel"); } foreach (string Interrupt in Interrupts) { Spellbook.Add(Interrupt); Macros.Add(Interrupt + "1", "/cast [@arena1] " + Interrupt); Macros.Add(Interrupt + "2", "/cast [@arena2] " + Interrupt); Macros.Add(Interrupt + "3", "/cast [@arena3] " + Interrupt); } foreach (string Special in Specials) { Spellbook.Add(Special); Macros.Add(Special + "1", "/cast [@arena1] " + Special); Macros.Add(Special + "2", "/cast [@arena2] " + Special); Macros.Add(Special + "3", "/cast [@arena3] " + Special); } foreach (string immune in immunes) { Buffs.Add(immune); } foreach (string spell_immune in spell_immunes) { Buffs.Add(spell_immune); } foreach (string physical_immune in physical_immunes) { Buffs.Add(physical_immune); } CustomCommands.Add("SaveKicks"); }
public void UseBuff(Buff buff) { BuffStartUse(buff); Buffs.Add(buff); }
public void AddBuff(IBuff b) { lock (_buffsLock) { if (!Buffs.ContainsKey(b.Name)) { if (HasBuff(b.Name)) { var buff = GetBuffsWithName(b.Name)[0]; Buffs.Add(b.Name, buff); return; } Buffs.Add(b.Name, b); BuffList.Add(b); if (!b.IsHidden) { _game.PacketNotifier.NotifyNPC_BuffAdd2(b); } b.ActivateBuff(); } else if (b.BuffAddType == BuffAddType.REPLACE_EXISTING) { var prevbuff = Buffs[b.Name]; prevbuff.DeactivateBuff(); RemoveBuff(b.Name); BuffList.Remove(prevbuff); RemoveBuffSlot(b); BuffSlots[prevbuff.Slot] = b; b.SetSlot(prevbuff.Slot); Buffs.Add(b.Name, b); BuffList.Add(b); if (!b.IsHidden) { _game.PacketNotifier.NotifyNPC_BuffReplace(b); } b.ActivateBuff(); } else if (b.BuffAddType == BuffAddType.RENEW_EXISTING) { Buffs[b.Name].ResetTimeElapsed(); if (!b.IsHidden) { _game.PacketNotifier.NotifyNPC_BuffReplace(Buffs[b.Name]); } RemoveStatModifier(Buffs[b.Name].GetStatsModifier()); // TODO: Replace with a better method that unloads -> reloads all data of a script Buffs[b.Name].ActivateBuff(); } else if (b.BuffAddType == BuffAddType.STACKS_AND_OVERLAPS) { if (Buffs[b.Name].StackCount >= Buffs[b.Name].MaxStacks) { var tempbuffs = GetBuffsWithName(b.Name); var oldestbuff = tempbuffs[0]; oldestbuff.DeactivateBuff(); RemoveBuff(b.Name); BuffList.Remove(oldestbuff); RemoveBuffSlot(oldestbuff); tempbuffs = GetBuffsWithName(b.Name); BuffSlots[oldestbuff.Slot] = tempbuffs[0]; Buffs.Add(oldestbuff.Name, tempbuffs[0]); BuffList.Add(b); if (!b.IsHidden) { if (Buffs[b.Name].BuffType == BuffType.COUNTER) { _game.PacketNotifier.NotifyNPC_BuffUpdateNumCounter(Buffs[b.Name]); } else { _game.PacketNotifier.NotifyNPC_BuffUpdateCount(b, b.Duration, b.TimeElapsed); } } b.ActivateBuff(); return; } BuffList.Add(b); Buffs[b.Name].IncrementStackCount(); GetBuffsWithName(b.Name).ForEach(buff => buff.SetStacks(Buffs[b.Name].StackCount)); if (!b.IsHidden) { if (b.BuffType == BuffType.COUNTER) { _game.PacketNotifier.NotifyNPC_BuffUpdateNumCounter(Buffs[b.Name]); } else { _game.PacketNotifier.NotifyNPC_BuffUpdateCount(b, b.Duration, b.TimeElapsed); } } b.ActivateBuff(); } else if (Buffs[b.Name].BuffAddType == BuffAddType.STACKS_AND_RENEWS) { RemoveBuffSlot(b); Buffs[b.Name].ResetTimeElapsed(); Buffs[b.Name].IncrementStackCount(); if (!b.IsHidden) { if (Buffs[b.Name].BuffType == BuffType.COUNTER) { _game.PacketNotifier.NotifyNPC_BuffUpdateNumCounter(Buffs[b.Name]); } else { _game.PacketNotifier.NotifyNPC_BuffUpdateCount(Buffs[b.Name], Buffs[b.Name].Duration, Buffs[b.Name].TimeElapsed); } } RemoveStatModifier(Buffs[b.Name].GetStatsModifier()); // TODO: Replace with a better method that unloads -> reloads all data of a script Buffs[b.Name].ActivateBuff(); } } }