public List <IBuff> GetBuffsWithName(string buffName) { lock (_buffsLock) { return(BuffList.FindAll(b => b.IsBuffSame(buffName))); } }
public int EndTurn() { var Damage = 0; foreach (var Buff in BuffsAct[BuffActiveType.ACTIVE_ENDTURN]) { if (Buff.ApplyEffect(ref Damage) == -3) { return(-3); } } foreach (var Buff in this.BuffsDec[BuffDecrementType.TYPE_ENDTURN]) { if (Buff.DecrementDuration() <= 0) { if (Buff.RemoveEffect() == -3) { return(-3); } } } this.BuffsDec[BuffDecrementType.TYPE_ENDTURN].RemoveAll(x => x.Duration <= 0); foreach (var BuffList in this.BuffsAct.Values) { BuffList.RemoveAll(Buff => Buff.DecrementType == BuffDecrementType.TYPE_ENDTURN && Buff.Duration <= 0); } return(-1); }
public void Tick(float dt, IResultControl control) { //此处用for是因为方便buff的tick中添加buff,但删除buff只能在所有buff的tick之后 bool isCalcProperty = false; for (int i = 0; i < BuffList.Count; ++i) { BuffList[i].IsRemoveBuff(dt, control); BuffList[i].Tick(control, dt); if (BuffList[i].IsNeedRemove && BuffList[i].IsCalcProperty) { isCalcProperty = true; } } int removedBuffCount = BuffList.RemoveAll(Temp_Remove_Buff); if (isCalcProperty || removedBuffCount > 0) { if (isCalcProperty) { BuffResult(); } else { RefreshBuffGraphics(); } } }
/// <summary> /// Debuff le personnage de tous les effets /// </summary> /// <returns></returns> public int Debuff() { foreach (var Buff in this.BuffsDec[BuffDecrementType.TYPE_BEGINTURN]) { if (Buff.IsDebuffable) { if (Buff.RemoveEffect() == -3) { return(-3); } } } foreach (var Buff in this.BuffsDec[BuffDecrementType.TYPE_ENDTURN]) { if (Buff.IsDebuffable) { if (Buff.RemoveEffect() == -3) { return(-3); } } } this.BuffsDec[BuffDecrementType.TYPE_BEGINTURN].RemoveAll(x => x.IsDebuffable); this.BuffsDec[BuffDecrementType.TYPE_ENDTURN].RemoveAll(x => x.IsDebuffable); foreach (var BuffList in this.BuffsAct.Values) { BuffList.RemoveAll(x => x.IsDebuffable); } return(-1); }
public void SetBuff(BuffList bufftype) { if (bufftype == BuffList.Piercing) { piercingActivated = true; PATimer += 20; GetComponent <SpriteRenderer> ().color = Color.red; } if (bufftype == BuffList.Explosion) { ExplosionActivated = true; EATimer += 20; ExplosionBuffEffect.SetActive(true); } if (bufftype == BuffList.Multi) { if (GameObject.FindGameObjectsWithTag("Ball").Length < 30) { for (int i = 0; i < 5; i++) { GameObject b = Instantiate(MultiBall, transform.position, Quaternion.identity); float randomdirectionX = (float)Random.Range(-8, 8); float randomdirectionY = (float)Random.Range(-8, 8); b.GetComponent <Rigidbody2D> ().AddForce(new Vector3(randomdirectionX, randomdirectionY, 0)); } } } }
/******************** default constructor ***************************/ public Character() { stat_hitPoints = stat_abilityPoints = stat_attackPower = stat_defenseRating = stat_abilityPower = stat_magicDefense = stat_constitution = stat_luck = xCoord = yCoord = 0; buffList = null; inventory = null; equipSlot_helmet = equipSlot_armor = equipSlot_gadget = equipSlot_weapon = null; }
//释放所有资源 public void ReleaseAll() { for (int i = 0; i < BuffList.Count; ++i) { Buff buff = BuffList[i]; ReleaseBuff(buff); } BuffList.Clear(); }
public void RemoveBuffsWithName(string buffName) { lock (_buffsLock) { BuffList.FindAll(b => b.IsBuffSame(buffName)).ForEach(b => b.DeactivateBuff()); } }
// Use this for initialization void Start() { SR = GetComponent <SpriteRenderer> (); bc = GetComponent <BoxCollider2D> (); Health = 0; SR.color = Color.clear; DisableBC(); BuffType = 0; }
public BuffCalculation(Transform character) { Character = character; property = character.GetComponent<CharacterProperty>(); buffList = character.GetComponent<BuffList>(); selection = character.GetComponent<CharacterSelect>(); addBuff = (BuffType[])buffList.addBuff.Clone(); deBuff = (BuffType[])buffList.deBuff.Clone(); playerSide = property.Player; }
public override void displayPlayer(PlayerInfo _pInfo) { string output = ""; output += new ClientInfoList(_pInfo, _options).DisplayShort(_sep); output += _sep; output += new BuffList(_pInfo, _options).Display(_sep); SendOutput(output); }
public BuffCalculation(Transform character) { Character = character; property = character.GetComponent <CharacterProperty>(); buffList = character.GetComponent <BuffList>(); selection = character.GetComponent <CharacterSelect>(); addBuff = (BuffType[])buffList.addBuff.Clone(); deBuff = (BuffType[])buffList.deBuff.Clone(); playerSide = property.Player; }
public void RemoveBuff(int buffID, IResultControl control) { Buff buff = BuffList.Find(item => item.BuffID == buffID); if (null == buff) { return; } buff.MarkRemove(control); }
public bool HasBuff(EffectEnum effect) { foreach (var BuffList in BuffsAct.Values) { if (BuffList.Exists(buff => buff.CastInfos.EffectType == effect)) { return(true); } } return(false); }
public Buff Init(BuffList id, float duration, int value, StatusEffect onApplyStateEffect, StatusEffect onTickStatEffect = StatusEffect.None, int onTickStatEffectValue = 0) { this.BuffId = id; this.duration = duration; this.OnApplyStatusEffectValue = value; this.OnApplyStatusEffect = onApplyStateEffect; this.OnTickStatusEffect = onTickStatEffect; this.OnTickStatusEffectValue = onTickStatEffectValue; return(this); }
public void RemoveAllBuffs() { //note this removes them all but doesnt reset the sparepoints!(should make some sort of 'refreshpoints' procedure for that SendServerPacket(new ServerPackets.GuildBuffList { Remove = 1, ActiveBuffs = BuffList }); BuffList.Clear(); RefreshAllStats(); NeedSave = true; }
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 BattlePlayerData(MapPlayerData mapPlayerData, BattlePlayer owner) : base(null, null) { Name = mapPlayerData.Name; Level = mapPlayerData.Level; HP = mapPlayerData.HP; MaxHP = mapPlayerData.MaxHP; MP = mapPlayerData.MP; MaxMP = mapPlayerData.MaxMP; HeadIcon = mapPlayerData.HeadIcon; MapSkillID = mapPlayerData.MapSkillID; BattleSkillID = mapPlayerData.BattleSkillID; UsingCharacter = mapPlayerData.UsingCharacter; Food = mapPlayerData.Food; MaxFood = mapPlayerData.MaxFood; Gold = mapPlayerData.Gold; SkillId = mapPlayerData.BattleSkillID; ClassData = mapPlayerData.ClassData; //玩家的行动值初始 AP = MaxAP = 0; CardList.Clear(); EquipList.Capacity = (mapPlayerData.EquipList.Count); for (int i = 0; i < mapPlayerData.EquipList.Count; i++) { List <int> actions = mapPlayerData.EquipList[i].Data.ActionTypes; for (int j = 0; j < actions.Count; j++) { if (actions[i] == (int)BattleActionType.AddEquipment) { EquipList.Add(new BattleEquipData(mapPlayerData.EquipList[j].Data.ActionParams[0], owner)); break; } } } CardList.Capacity = mapPlayerData.CardList.Count; for (int i = 0; i < mapPlayerData.CardList.Count; i++) { CardList.Add(new BattleCardData(mapPlayerData.CardList[i].CardId, owner)); } BuffList.Capacity = mapPlayerData.BuffList.Count; for (int i = 0; i < mapPlayerData.BuffList.Count; i++) { BuffList.Add(new BattleBuffData(mapPlayerData.BuffList[i].Data.ActionParams[0], -1, 0, new BattleCardData(mapPlayerData.BuffList[i].CardId, owner), owner, owner)); } CurrentCardList.Capacity = CardList.Count; for (int i = 0; i < CardList.Count; i++) { CurrentCardList.Add(new BattleCardData(CardList[i].CardId, owner)); } }
public void NewBuff(int Id, bool charge = true) { GuildBuffInfo info = Envir.FindGuildBuffInfo(Id); if (info == null) { return; } GuildBuff buff = new GuildBuff() { Id = Id, Info = info, Active = true, }; buff.ActiveTimeRemaining = buff.Info.TimeLimit; if (charge) { ChargeForBuff(buff); } BuffList.Add(buff); List <GuildBuff> NewBuff = new List <GuildBuff> { buff }; SendServerPacket(new ServerPackets.GuildBuffList { ActiveBuffs = NewBuff }); //now tell everyone our new sparepoints for (int i = 0; i < Ranks.Count; i++) { for (int j = 0; j < Ranks[i].Members.Count; j++) { if (Ranks[i].Members[j].Player != null) { SendGuildStatus((PlayerObject)Ranks[i].Members[j].Player); } } } NeedSave = true; RefreshAllStats(); }
void updateRound(IList chesses) { foreach (Transform gf in chesses) { CharacterProperty gfp = gf.GetComponent <CharacterProperty>(); BuffList gfB = gf.GetComponent <BuffList>(); gfp.Moved = false; gfp.Attacked = false; gfp.Activated = false; gfp.TurnFinished = false; if (!gfp.death && gfp.AbleRestore) { gfp.Hp = gfp.ModifiedDefPow; } } }
/// <summary> /// 是否具备某个射程 /// </summary> /// <param name="range">射程</param> /// <returns></returns> public bool HasRange(RangeEnum range) { bool hasNow = ranges.Contains(range); BuffList.ForEach(x => { RangeBuff buff = x as RangeBuff; if (buff != null) { if (buff.IsAdding) { hasNow = true; return; } else { hasNow = false; } } }); return(hasNow); }
/// <summary> /// 是否具备某个属性 /// </summary> /// <param name="type">属性</param> /// <returns></returns> public bool HasType(TypeEnum type) { bool hasNow = types.Contains(type); BuffList.ForEach(x => { TypeBuff buff = x as TypeBuff; if (buff != null) { if (buff.IsAdding) { hasNow = true; return; } else { hasNow = false; } } }); return(hasNow); }
/// <summary> /// 是否具备某个武器 /// </summary> /// <param name="weapon">武器</param> /// <returns></returns> public bool HasWeapon(WeaponEnum weapon) { bool hasNow = weapons.Contains(weapon); BuffList.ForEach(x => { WeaponBuff buff = x as WeaponBuff; if (buff != null) { if (buff.IsAdding) { hasNow = true; return; } else { hasNow = false; } } }); return(hasNow); }
/// <summary> /// 是否具备某个势力 /// </summary> /// <param name="symbol">势力</param> /// <returns></returns> public bool HasSymbol(SymbolEnum symbol) { bool hasNow = symbols.Contains(symbol); BuffList.ForEach(x => { SymbolBuff buff = x as SymbolBuff; if (buff != null) { if (buff.IsAdding) { hasNow = true; return; } else { hasNow = false; } } }); return(hasNow); }
public override void displayPlayer(PlayerInfo _pInfo) { string output = ""; output += new ClientInfoList(_pInfo, _options).Display(_sep); output += _sep; output += new StatsList(_pInfo, _options).Display(_sep); output += _sep; output += new BuffList(_pInfo, _options).Display(_sep); output += _sep; output += new SkillList(_pInfo, _options).Display(_sep); output += _sep; output += new QuestList(_pInfo, _options).Display(_sep); output += _sep; output += new SpawnpointList(_pInfo, _options).Display(_sep); output += _sep; output += new WaypointList(_pInfo, _options).Display(_sep); output += _sep; output += new FavoriteRecipeList(_pInfo, _options).Display(_sep); output += _sep; output += new UnlockedRecipeList(_pInfo, _options).Display(_sep); output += _sep; output += new CraftingQueue(_pInfo, _options).Display(_sep); output += _sep; output += new ToolbeltList(_pInfo, _options).Display(_sep); output += _sep; output += new EquipmentList(_pInfo, _options).Display(_sep); output += _sep; output += new BagList(_pInfo, _options).Display(_sep); output += _sep; // todo: // friends // tracked friends // _pdf.trackedFriendEntityIds //List<int> // claims (_ppd.LPBlocks) // list owned storage containers and doors for the players SendOutput(output); }
/// <summary> /// 是否具备某个性别 /// </summary> /// <param name="gender">性别</param> /// <returns></returns> public bool HasGender(GenderEnum gender) { bool hasNow = genders.Contains(gender); BuffList.ForEach(x => { GenderBuff buff = x as GenderBuff; if (buff != null) { if (buff.IsAdding) { hasNow = true; return; } else { hasNow = false; } } }); return(hasNow); }
/// <summary> /// Remove a buff and its effects from the agent /// </summary> public void RemoveBuff(Buff buff) { BuffList.Remove(buff); }
public ActorData(long address) { Address = address; BuffList = new BuffList(Address + Offsets.OActiveBuffList); }
public bool HasBuff(IBuff buff) { return(!(BuffList.Find(b => b == buff) == null)); }
public bool HasBuff(string buffName) { return(!(BuffList.Find(b => b.IsBuffSame(buffName)) == null)); }
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(); } } }