private void HandleTeleportMastery(int nSkillID, byte nSLV) { if (!Parent.Buffs.Contains(nSkillID)) { var newBuff = new BuffSkill(nSkillID, nSLV); newBuff.Generate(0); Parent.Buffs.Add(newBuff); } else { Parent.Buffs.Remove(nSkillID); } }
public void AddSkillBuff(int nSkillID, int nSLV, double durationMultiplier = 1.0, int nOption = 0) { if (nSkillID == (int)Skills.MECHANIC_SAFETY) { nOption = Parent.Stats.SecondaryStats.rBeholder; } if (GetOrDefault(nSkillID) is BuffSkill bs) { if (bs.nSLV < nSLV) { bs.nSLV = (byte)nSLV; } bs.State = nOption; UpdateBuffInfo(bs); } else { var newBuff = new BuffSkill(nSkillID, (byte)nSLV); if (newBuff.Template.Morph > 0) { newBuff.State = Parent.Stats.nGender; // haxed } newBuff.Generate(durationMultiplier); if (newBuff.StatType != SecondaryStatFlag.None_DONT_USE) // TODO phase this out { RemoveIf(b => b.StatType == newBuff.StatType); } if (newBuff.Template.HasAffected) { var effect = new UserEffectPacket(UserEffect.SkillAffected) { nSkillID = nSkillID, }; effect.BroadcastEffect(Parent); } newBuff.State = nOption; Add(newBuff); } }
//public AbstractBuff GetByType(SecondaryStatFlag type) => this.FirstOrDefault(c => c.StatType == type); ///// <summary> ///// This is not foolproof, it only checks the buff StatType variable and returns the first ///// stat entry that is equal to nType in the Stat collection. ///// </summary> ///// <param name="nType"></param> ///// <param name="nDefaultValue"></param> ///// <returns></returns> //public int nOptionData(SecondaryStatFlag nType, int nDefaultValue = 0) //{ // // TODO phase this whole function out, its bad // foreach (var item in this) // { // if (item.StatType != nType) continue; // foreach (var stat in item.Stat) // { // if (stat.Key != nType) continue; // return stat.Value.nValue; // } // } // return nDefaultValue; //} public void DoCombatOrders(int nSkillID, byte nSLV) { if (GetOrDefault(nSkillID) is BuffSkill curCO && curCO.nSLV >= nSLV) { UpdateBuffInfo(curCO); return; } var entry = new BuffSkill(nSkillID, nSLV); entry.State = (int)entry.Template.X(nSLV); entry.Generate(); Add(entry); // TODO just make nSLV look at combat orders SecondaryStat value instead of modifying all these foreach (var skill in Parent.Skills) { if (skill.nSLV > 0 && skill.nSkillID != nSkillID) // combat orders will affect hidden skills but not itself { skill.CombatOrders = entry.State; } } }