public static void AddDamageBonus(Fighter fighter, SpellLevelRecord level, ExtendedSpellEffect effect, List <Fighter> affecteds, short castcellid) { foreach (var target in affecteds) { var definition = new UInt16ReflectedStat(StatsRecord.GetFieldInfo("AllDamagesBonus"), target.FighterStats.Stats); target.AddBuff(new StatBuff((uint)target.BuffIdProvider.Pop(), definition, (uint)effect.BaseEffect.EffectType, effect.BaseEffect.DiceNum, effect.BaseEffect.Duration, fighter.ContextualId, (short)level.SpellId, effect.BaseEffect.DiceNum, effect.BaseEffect.Delay)); } }
public static void AddVitality(Fighter fighter, SpellLevelRecord level, ExtendedSpellEffect effect, List <Fighter> affected, short castcellid) { foreach (var target in affected) { var definition = new UInt16ReflectedStat(StatsRecord.GetFieldInfo("LifePoints"), target.FighterStats.Stats); target.AddBuff(new StatBuff((uint)target.BuffIdProvider.Pop(), definition, (uint)ActionsEnum.ACTION_CHARACTER_BOOST_VITALITY, effect.BaseEffect.DiceNum, effect.BaseEffect.Duration, fighter.ContextualId, (short)level.SpellId, effect.BaseEffect.DiceNum, effect.BaseEffect.Delay)); } }
public static void EarthResistPercent(Fighter fighter, SpellLevelRecord level, ExtendedSpellEffect effect, List <Fighter> affecteds, short castcellid) { foreach (var target in affecteds) { var statdefinition = new UInt16ReflectedStat(StatsRecord.GetFieldInfo("EarthResistPercent"), fighter.FighterStats.Stats); StatBuff buff = new StatBuff((uint)target.BuffIdProvider.Pop(), statdefinition, (uint)effect.BaseEffect.EffectType, effect.BaseEffect.DiceNum, effect.BaseEffect.Duration, fighter.ContextualId, (short)level.SpellId, effect.BaseEffect.DiceNum, effect.BaseEffect.Delay); target.AddBuff(buff); } }
public static void HandleStatsUpgrade(StatsUpgradeRequestMessage message, WorldClient client) { if (client.Character.IsFighting) { client.Send(new StatsUpgradeResultMessage((sbyte)StatsUpgradeResultEnum.IN_FIGHT, 0)); return; } StatsBoostTypeEnum statId = (StatsBoostTypeEnum)message.statId; if (statId < StatsBoostTypeEnum.Strength || statId > StatsBoostTypeEnum.Intelligence) { Logger.Error("Wrong statsid"); } if (message.boostPoint > 0) { UInt16ReflectedStat linkedStat = GetReflectedStat(client.Character.StatsRecord, statId); BreedRecord breed = BreedRecord.GetBreed(client.Character.Record.Breed); int num = linkedStat.GetValue(); ushort num2 = message.boostPoint; if (num2 >= 1 && message.boostPoint <= (short)client.Character.Record.StatsPoints) { uint[][] thresholds = breed.GetThresholds(statId); int thresholdIndex = breed.GetThresholdIndex(num, thresholds); while ((long)num2 >= (long)((ulong)thresholds[thresholdIndex][1])) { short num3; short num4; if (thresholdIndex < thresholds.Length - 1 && (double)num2 / thresholds[thresholdIndex][1] > (double)((ulong)thresholds[thresholdIndex + 1][0] - (ulong)((long)num))) { num3 = (short)((ulong)thresholds[thresholdIndex + 1][0] - (ulong)((long)num)); num4 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][1])); if (thresholds[thresholdIndex].Length > 2) { num3 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][2])); } } else { num3 = (short)System.Math.Floor((double)num2 / thresholds[thresholdIndex][1]); num4 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][1])); if (thresholds[thresholdIndex].Length > 2) { num3 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][2])); } } num += (int)num3; num2 -= (ushort)num4; thresholdIndex = breed.GetThresholdIndex(num, thresholds); } if (statId == StatsBoostTypeEnum.Vitality) { var previousVitality = linkedStat.GetValue(); linkedStat.SetValue((short)num); client.Character.StatsRecord.LifePoints += (short)(client.Character.StatsRecord.BaseVitality - previousVitality); client.Character.CurrentStats.LifePoints += (uint)(client.Character.StatsRecord.BaseVitality - previousVitality); } else { linkedStat.SetValue((short)num); } client.Character.Record.StatsPoints -= (ushort)(message.boostPoint - num2); client.Send(new StatsUpgradeResultMessage((sbyte)StatsUpgradeResultEnum.SUCCESS, message.boostPoint)); client.Character.RefreshStats(); } } }