private void RefreshBuffs() { for (int i = 0; i < GameScene.Scene.Buffs.Count; i++) { Buff buff = GameScene.Scene.Buffs[i]; switch (buff.Type) { case BuffType.Haste: case BuffType.Fury: ASpeed = (sbyte)Math.Max(sbyte.MinValue, (Math.Min(sbyte.MaxValue, ASpeed + buff.Value))); break; case BuffType.SwiftFeet: Sprint = true; break; case BuffType.LightBody: Agility = (byte)Math.Min(byte.MaxValue, Agility + buff.Value); break; case BuffType.SoulShield: MaxMAC = (byte)Math.Min(byte.MaxValue, MaxMAC + buff.Value); break; case BuffType.BlessedArmour: MaxAC = (byte)Math.Min(byte.MaxValue, MaxAC + buff.Value); break; case BuffType.UltimateEnhancer: MaxDC = (byte)Math.Min(byte.MaxValue, MaxDC + buff.Value); break; case BuffType.ProtectionField: MaxAC = (byte)Math.Min(byte.MaxValue, MaxAC + buff.Value); break; case BuffType.Rage: MaxDC = (byte)Math.Min(byte.MaxValue, MaxDC + buff.Value); break; case BuffType.CounterAttack: MinAC = (byte)Math.Min(byte.MaxValue, MinAC + buff.Value); MinMAC = (byte)Math.Min(byte.MaxValue, MinMAC + buff.Value); MaxAC = (byte)Math.Min(byte.MaxValue, MaxAC + buff.Value); MaxMAC = (byte)Math.Min(byte.MaxValue, MaxMAC + buff.Value); break; case BuffType.Curse: byte rMaxDC = (byte)(((int)MaxDC / 100) * buff.Value); byte rMaxMC = (byte)(((int)MaxMC / 100) * buff.Value); byte rMaxSC = (byte)(((int)MaxSC / 100) * buff.Value); byte rASpeed = (byte)(((int)ASpeed / 100) * buff.Value); MaxDC = (byte)Math.Max(byte.MinValue, MaxDC - rMaxDC); MaxMC = (byte)Math.Max(byte.MinValue, MaxMC - rMaxMC); MaxSC = (byte)Math.Max(byte.MinValue, MaxSC - rMaxSC); ASpeed = (sbyte)Math.Min(sbyte.MaxValue, (Math.Max(sbyte.MinValue, ASpeed - rASpeed))); break; case BuffType.Impact: MaxDC = (byte)Math.Min(byte.MaxValue, MaxDC + buff.Value); break; case BuffType.Magic: MaxMC = (byte)Math.Min(byte.MaxValue, MaxMC + buff.Value); break; case BuffType.Taoist: MaxSC = (byte)Math.Min(byte.MaxValue, MaxSC + buff.Value); break; case BuffType.Storm: ASpeed = (sbyte)Math.Max(sbyte.MinValue, (Math.Min(sbyte.MaxValue, ASpeed + buff.Value))); break; case BuffType.HealthAid: MaxHP = (ushort)Math.Min(ushort.MaxValue, MaxHP + buff.Value); break; case BuffType.ManaAid: MaxMP = (ushort)Math.Min(ushort.MaxValue, MaxMP + buff.Value); break; case BuffType.WonderShield: MinAC = (byte)Math.Min(byte.MaxValue, MinAC + buff.Value); MaxAC = (byte)Math.Min(byte.MaxValue, MaxAC + buff.Value); break; case BuffType.MagicWonderShield: MinMAC = (byte)Math.Min(byte.MaxValue, MinMAC + buff.Value); MaxMAC = (byte)Math.Min(byte.MaxValue, MaxMAC + buff.Value); break; case BuffType.BagWeight: MaxBagWeight = (ushort)Math.Min(ushort.MaxValue, MaxBagWeight + buff.Value); break; } } }
private void RefreshBuffs() { TransformType = -1; for (int i = 0; i < GameScene.Scene.Buffs.Count; i++) { Buff buff = GameScene.Scene.Buffs[i]; switch (buff.Type) { case BuffType.Haste: case BuffType.Fury: ASpeed = (sbyte)Math.Max(sbyte.MinValue, (Math.Min(sbyte.MaxValue, ASpeed + buff.Values[0]))); break; case BuffType.ImmortalSkin: MaxAC = (ushort)Math.Min(ushort.MaxValue, MaxAC + buff.Values[0]); MaxDC = (ushort)Math.Max(ushort.MinValue, MaxDC - buff.Values[1]); break; case BuffType.SwiftFeet: Sprint = true; break; case BuffType.LightBody: Agility = (byte)Math.Min(ushort.MaxValue, Agility + buff.Values[0]); break; case BuffType.SoulShield: MaxMAC = (ushort)Math.Min(ushort.MaxValue, MaxMAC + buff.Values[0]); break; case BuffType.BlessedArmour: MaxAC = (ushort)Math.Min(ushort.MaxValue, MaxAC + buff.Values[0]); break; case BuffType.UltimateEnhancer: if (Class == MirClass.Wizard || Class == MirClass.Archer) { MaxMC = (ushort)Math.Min(ushort.MaxValue, MaxMC + buff.Values[0]); } else if (Class == MirClass.Taoist) { MaxSC = (ushort)Math.Min(ushort.MaxValue, MaxSC + buff.Values[0]); } else { MaxDC = (ushort)Math.Min(ushort.MaxValue, MaxDC + buff.Values[0]); } break; case BuffType.ProtectionField: MaxAC = (ushort)Math.Min(ushort.MaxValue, MaxAC + buff.Values[0]); break; case BuffType.Rage: MaxDC = (ushort)Math.Min(ushort.MaxValue, MaxDC + buff.Values[0]); break; case BuffType.CounterAttack: MinAC = (ushort)Math.Min(ushort.MaxValue, MinAC + buff.Values[0]); MinMAC = (ushort)Math.Min(ushort.MaxValue, MinMAC + buff.Values[0]); MaxAC = (ushort)Math.Min(ushort.MaxValue, MaxAC + buff.Values[0]); MaxMAC = (ushort)Math.Min(ushort.MaxValue, MaxMAC + buff.Values[0]); break; case BuffType.Curse: ushort rMaxDC = (ushort)(((int)MaxDC / 100) * buff.Values[0]); ushort rMaxMC = (ushort)(((int)MaxMC / 100) * buff.Values[0]); ushort rMaxSC = (ushort)(((int)MaxSC / 100) * buff.Values[0]); byte rASpeed = (byte)(((int)ASpeed / 100) * buff.Values[0]); MaxDC = (ushort)Math.Max(ushort.MinValue, MaxDC - rMaxDC); MaxMC = (ushort)Math.Max(ushort.MinValue, MaxMC - rMaxMC); MaxSC = (ushort)Math.Max(ushort.MinValue, MaxSC - rMaxSC); ASpeed = (sbyte)Math.Min(sbyte.MaxValue, (Math.Max(sbyte.MinValue, ASpeed - rASpeed))); break; case BuffType.MagicBooster: MinMC = (ushort)Math.Min(ushort.MaxValue, MinMC + buff.Values[0]); MaxMC = (ushort)Math.Min(ushort.MaxValue, MaxMC + buff.Values[0]); break; case BuffType.Knapsack: case BuffType.BagWeight: MaxBagWeight = (ushort)Math.Min(ushort.MaxValue, MaxBagWeight + buff.Values[0]); break; case BuffType.Transform: TransformType = (short)buff.Values[0]; break; case BuffType.Impact: MaxDC = (ushort)Math.Min(ushort.MaxValue, MaxDC + buff.Values[0]); break; case BuffType.Magic: MaxMC = (ushort)Math.Min(ushort.MaxValue, MaxMC + buff.Values[0]); break; case BuffType.Taoist: MaxSC = (ushort)Math.Min(ushort.MaxValue, MaxSC + buff.Values[0]); break; case BuffType.Storm: ASpeed = (sbyte)Math.Max(sbyte.MinValue, (Math.Min(sbyte.MaxValue, ASpeed + buff.Values[0]))); break; case BuffType.HealthAid: MaxHP = (ushort)Math.Min(ushort.MaxValue, MaxHP + buff.Values[0]); break; case BuffType.ManaAid: MaxMP = (ushort)Math.Min(ushort.MaxValue, MaxMP + buff.Values[0]); break; case BuffType.Defence: MaxAC = (ushort)Math.Min(ushort.MaxValue, MaxAC + buff.Values[0]); break; case BuffType.MagicDefence: MaxMAC = (ushort)Math.Min(ushort.MaxValue, MaxMAC + buff.Values[0]); break; case BuffType.WonderDrug: switch (buff.Values[0]) { case 2: MaxHP = (ushort)Math.Min(ushort.MaxValue, MaxHP + buff.Values[1]); break; case 3: MaxMP = (ushort)Math.Min(ushort.MaxValue, MaxMP + buff.Values[1]); break; case 4: MinAC = (ushort)Math.Min(ushort.MaxValue, MinAC + buff.Values[1]); MaxAC = (ushort)Math.Min(ushort.MaxValue, MaxAC + buff.Values[1]); break; case 5: MinMAC = (ushort)Math.Min(ushort.MaxValue, MinMAC + buff.Values[1]); MaxMAC = (ushort)Math.Min(ushort.MaxValue, MaxMAC + buff.Values[1]); break; case 6: ASpeed = (sbyte)Math.Max(sbyte.MinValue, (Math.Min(sbyte.MaxValue, ASpeed + buff.Values[1]))); break; } break; } } }