From 5d41d2c9dc22d38eb7877b0ef520602c42e1d48d Mon Sep 17 00:00:00 2001 From: Baptiste Marie Date: Sat, 27 Jul 2024 06:12:31 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20Ethereal=20Bond=20*=20Due=20to=20an=20old?= =?UTF-8?q?=20Atlas=20bug,=20it=20was=20applied=20to=20the=20base=20mana?= =?UTF-8?q?=20pool=20as=20a=20percentage=20using=20the=20level=20instead?= =?UTF-8?q?=20of=20the=20value,=20then=20again=20in=20`MaxManaCalculator`?= =?UTF-8?q?=20but=20as=20a=20flat=20bonus=20using=20the=20value.=20Most=20?= =?UTF-8?q?likely=20caused=20by=20a=20confusion=20between=20old=20(power?= =?UTF-8?q?=20pool%)=20and=20new=20(flat=20power)=20Ethereal=20Bonds..=20*?= =?UTF-8?q?=20Changed=20its=20type=20to=20`eProperty.PowerPool`,=20since?= =?UTF-8?q?=20we=E2=80=99re=20using=20the=20old=20one.=20*=20Whether=20it?= =?UTF-8?q?=20should=20be=20applied=20on=20base=20power=20pool=20or=20tota?= =?UTF-8?q?l=20power=20pool=20is=20unclear.=20This=20makes=20a=20differenc?= =?UTF-8?q?e=20for=20Theurgist=20pets=20for=20example.=20For=20now,=20It?= =?UTF-8?q?=20will=20be=20applied=20to=20the=20total=20power=20pool.=20*?= =?UTF-8?q?=20Made=20it=20additive=20with=20ToA=20power=20pool%=20bonus,?= =?UTF-8?q?=20since=20it=20now=20works=20the=20same=20way.=20*=20Replacing?= =?UTF-8?q?=20it=20with=20the=20newer=20version=20will=20require=20changin?= =?UTF-8?q?g=20it=E2=80=99s=20type=20back=20to=20`eProperty.MaxMana`.=20*?= =?UTF-8?q?=20Removed=20debug=20messages.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GameServer/gameobjects/GamePlayer.cs | 38 +---- GameServer/propertycalc/MaxManaCalculator.cs | 144 +++++++----------- .../handlers/AtlasOF_EtherealBondAbility.cs | 64 ++------ 3 files changed, 72 insertions(+), 174 deletions(-) diff --git a/GameServer/gameobjects/GamePlayer.cs b/GameServer/gameobjects/GamePlayer.cs index fee00d4a08..395fa60795 100644 --- a/GameServer/gameobjects/GamePlayer.cs +++ b/GameServer/gameobjects/GamePlayer.cs @@ -2719,14 +2719,11 @@ public override byte HealthPercentGroupWindow /// /// Calculate max mana for this player based on level and mana stat level /// - /// - /// - /// public virtual int CalculateMaxMana(int level, int manaStat) { - int maxpower = 0; + int maxPower = 0; - //Special handling for Vampiirs: + // Special handling for Vampiirs: /* There is no stat that affects the Vampiir's power pool or the damage done by its power based spells. * The Vampiir is not a focus based class like, say, an Enchanter. * The Vampiir is a lot more cut and dried than the typical casting class. @@ -2743,37 +2740,16 @@ public virtual int CalculateMaxMana(int level, int manaStat) * Strength ALSO affects the size of the power pool for a Vampiir sort of. * Your INNATE strength (the number of attribute points your character has for strength) has no effect at all. * Extra points added through ITEMS, however, does increase the size of your power pool. - */ - if (CharacterClass.ManaStat != eStat.UNDEFINED || CharacterClass.ID == (int)eCharacterClass.Vampiir) - { - maxpower = Math.Max(5, (level * 5) + (manaStat - 50)); - } - else if (CharacterClass.ManaStat == eStat.UNDEFINED && Champion && ChampionLevel > 0) - { - maxpower = 100; // This is a guess, need feedback - } - #region Calculation : AtlasOF_EtheralBond - // --- [START] --- AtlasOF_EtherealBond -------------------------------------------------------- - AtlasOF_EtherealBondAbility raEtherealBond = GetAbility(); - if (raEtherealBond != null) - { - if (raEtherealBond.Level > 0) - { - maxpower += (maxpower * raEtherealBond.Level) / 100; - } - } - // --- [ END ] --- AtlasOF_EtherealBond -------------------------------------------------------- - #endregion - - if (maxpower < 0) - maxpower = 0; + if (CharacterClass.ManaStat is not eStat.UNDEFINED || (eCharacterClass) CharacterClass.ID is eCharacterClass.Vampiir) + maxPower = Math.Max(5, level * 5 + (manaStat - 50)); + else if (Champion && ChampionLevel > 0) + maxPower = 100; // This is a guess, need feedback. - return maxpower; + return Math.Max(0, maxPower); } - /// /// Gets/sets the object mana /// diff --git a/GameServer/propertycalc/MaxManaCalculator.cs b/GameServer/propertycalc/MaxManaCalculator.cs index 237add814c..584dca6688 100644 --- a/GameServer/propertycalc/MaxManaCalculator.cs +++ b/GameServer/propertycalc/MaxManaCalculator.cs @@ -1,100 +1,66 @@ -/* - * DAWN OF LIGHT - The first free open source DAoC server emulator - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - */ using System; namespace DOL.GS.PropertyCalc { - /// - /// The Power Pool calculator - /// - /// BuffBonusCategory1 unused - /// BuffBonusCategory2 unused - /// BuffBonusCategory3 unused - /// BuffBonusCategory4 unused - /// BuffBonusMultCategory1 unused - /// - [PropertyCalculator(eProperty.MaxMana)] - public class MaxManaCalculator : PropertyCalculator - { - public MaxManaCalculator() {} + /// + /// The Power Pool calculator + /// + /// BuffBonusCategory1 unused + /// BuffBonusCategory2 unused + /// BuffBonusCategory3 unused + /// BuffBonusCategory4 unused + /// BuffBonusMultCategory1 unused + /// + [PropertyCalculator(eProperty.MaxMana)] + public class MaxManaCalculator : PropertyCalculator + { + public MaxManaCalculator() {} - public override int CalcValue(GameLiving living, eProperty property) - { - if (living is GamePlayer) - { - GamePlayer player = living as GamePlayer; - eStat manaStat = player.CharacterClass.ManaStat; + public override int CalcValue(GameLiving living, eProperty property) + { + if (living is not GamePlayer player) + return 0; - if (player.CharacterClass.ManaStat == eStat.UNDEFINED) - { - //Special handling for Vampiirs: - /* There is no stat that affects the Vampiir's power pool or the damage done by its power based spells. - * The Vampiir is not a focus based class like, say, an Enchanter. - * The Vampiir is a lot more cut and dried than the typical casting class. - * EDIT, 12/13/04 - I was told today that this answer is not entirely accurate. - * While there is no stat that affects the damage dealt (in the way that intelligence or piety affects how much damage a more traditional caster can do), - * the Vampiir's power pool capacity is intended to be increased as the Vampiir's strength increases. - * - * This means that strength ONLY affects a Vampiir's mana pool - */ - if (player.CharacterClass.ID == (int)eCharacterClass.Vampiir) - { - manaStat = eStat.STR; - } - else if (player.Champion && player.ChampionLevel > 0) - { - return player.CalculateMaxMana(player.Level, 0); - } - else - { - return 0; - } - } + eStat manaStat; - int manaBase = player.CalculateMaxMana(player.Level, player.GetModified((eProperty)manaStat)); - int itemBonus = living.ItemBonus[(int)property]; - int poolBonus = living.ItemBonus[(int)eProperty.PowerPool]; - int abilityBonus = living.AbilityBonus[(int)property]; + if (player.CharacterClass.ManaStat is not eStat.UNDEFINED) + manaStat = player.CharacterClass.ManaStat; + else + { + // Special handling for Vampiirs: + /* There is no stat that affects the Vampiir's power pool or the damage done by its power based spells. + * The Vampiir is not a focus based class like, say, an Enchanter. + * The Vampiir is a lot more cut and dried than the typical casting class. + * EDIT, 12/13/04 - I was told today that this answer is not entirely accurate. + * While there is no stat that affects the damage dealt (in the way that intelligence or piety affects how much damage a more traditional caster can do), + * the Vampiir's power pool capacity is intended to be increased as the Vampiir's strength increases. + * + * This means that strength ONLY affects a Vampiir's mana pool + */ + if ((eCharacterClass) player.CharacterClass.ID is eCharacterClass.Vampiir) + manaStat = eStat.STR; + else if (player.Champion && player.ChampionLevel > 0) + return player.CalculateMaxMana(player.Level, 0); + else + return 0; + } - int itemCap = player.Level / 2 + 1; - int poolCap = player.Level / 2; - itemCap = itemCap + Math.Min(player.ItemBonus[(int)eProperty.PowerPoolCapBonus], itemCap); - poolCap = poolCap + Math.Min(player.ItemBonus[(int)eProperty.PowerPoolCapBonus], player.Level); + int flatItemBonusCap = player.Level / 2 + 1; + int poolItemBonusCap = player.Level / 2 + Math.Min(player.ItemBonus[(int) eProperty.PowerPoolCapBonus], player.Level); + int manaBase = player.CalculateMaxMana(player.Level, player.GetModified((eProperty) manaStat)); + int flatItemBonus = Math.Min(flatItemBonusCap, living.ItemBonus[(int) property]); + int poolItemBonus = Math.Min(poolItemBonusCap, living.ItemBonus[(int) eProperty.PowerPool]); + int flatAbilityBonus = living.AbilityBonus[(int) property]; + int poolAbilityBonus = living.AbilityBonus[(int) eProperty.PowerPool]; - if (itemBonus > itemCap) { - itemBonus = itemCap; - } - if (poolBonus > poolCap) - poolBonus = poolCap; - - //Q: What exactly does the power pool % increase do?Does it increase the amount of power my cleric - //can generate (like having higher piety)? Or, like the dex cap increase, do I have to put spellcraft points into power to make it worth anything? - //A: I’m better off quoting Balance Boy directly here: ” Power pool is affected by - //your acuity stat, +power bonus, the Ethereal Bond Realm ability, and your level. - //The resulting power pool is adjusted by your power pool % increase bonus. - return (int)(manaBase + itemBonus + abilityBonus + (manaBase + itemBonus + abilityBonus) * poolBonus * 0.01); - } - else - { - return 1000000; // default - } - } - } + // Q: What exactly does the power pool % increase do? Does it increase the amount of power my cleric can generate (like having higher piety)? + // Or, like the dex cap increase, do I have to put spellcraft points into power to make it worth anything? + // A: I'm better off quoting Balance Boy directly here: "Power pool is affected by your acuity stat, +power bonus, + // the Ethereal Bond Realm ability, and your level. The resulting power pool is adjusted by your power pool % increase bonus. + double result = manaBase + flatItemBonus + flatAbilityBonus; + result *= 1 + (poolItemBonus + poolAbilityBonus) * 0.01; + return (int) result; + } + } } diff --git a/GameServer/realmabilities_atlasOF/handlers/AtlasOF_EtherealBondAbility.cs b/GameServer/realmabilities_atlasOF/handlers/AtlasOF_EtherealBondAbility.cs index ce29dd5c68..a4ad6a997a 100644 --- a/GameServer/realmabilities_atlasOF/handlers/AtlasOF_EtherealBondAbility.cs +++ b/GameServer/realmabilities_atlasOF/handlers/AtlasOF_EtherealBondAbility.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections; -using System.Collections.Generic; using DOL.Database; -using DOL.GS.Effects; -using DOL.GS.PacketHandler; -using DOL.Language; -using log4net; namespace DOL.GS.RealmAbilities { @@ -17,60 +10,23 @@ public class AtlasOF_EtherealBondAbility : RAPropertyEnhancer { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - public AtlasOF_EtherealBondAbility(DbAbility dba, int level) : base(dba, level, eProperty.MaxMana) { } + public AtlasOF_EtherealBondAbility(DbAbility dba, int level) : base(dba, level, eProperty.PowerPool) { } - protected override string ValueUnit { get { return "%"; } } + protected override string ValueUnit => "%"; - public override bool CheckRequirement(GamePlayer player) { return AtlasRAHelpers.GetSerenityLevel(player) >= 2; } - - public override int GetAmountForLevel(int level) { return AtlasRAHelpers.GetPropertyEnhancer3AmountForLevel(level); } - - public override int CostForUpgrade(int level) { return AtlasRAHelpers.GetCommonUpgradeCostFor5LevelsRA(level); } - - public override void Activate(GameLiving living, bool sendUpdates) + public override bool CheckRequirement(GamePlayer player) { - log.Warn("inside Activate"); - log.WarnFormat("1 - inside Activate Current maxmana is {0}", living.MaxMana); - base.Activate(living, sendUpdates); - log.WarnFormat("2 - inside Activate Current maxmana is {0}", living.MaxMana); - - /* - // Ethereal Bond : Increases maximum power by 3% per level of this ability. - // Pre-Requisits : Serenity lvl 2 - AtlasOF_SerenityAbility raSerenity = living.GetAbility(); - if (raSerenity != null) - { - log.WarnFormat("Serenity level is {0}", raSerenity.Level); - - if (raSerenity.Level < 2) - { - log.WarnFormat("Serenity level is {0} and pre-requisite needs Serenity to be at least lvl 2 so we CANNOT activate RA ability", raSerenity.Level); - return; - } - else - { - log.WarnFormat("Current MaxMana is {0}", living.MaxMana); - - AtlasOF_RAMaxManaEnhancer raMana = AtlasOF_RAMaxManaEnhancer(le) - - log.WarnFormat("Current MaxMana is {0}", living.MaxMana); - } - - } - else - { - log.WarnFormat("The player {0} does not have Serenity Ability and its a pre-requisite to Ethereal Bond", living.Name); - base.Deactivate(living, sendUpdates); - } - */ + return AtlasRAHelpers.GetSerenityLevel(player) >= 2; } - public override void OnLevelChange(int oldLevel, int newLevel = 0) + public override int GetAmountForLevel(int level) { - log.WarnFormat("1 - inside OnLevelChange, oldLevel {0}, newLevel {1}, Current maxmana is {2}", oldLevel, newLevel, base.m_activeLiving.MaxMana); - base.OnLevelChange(oldLevel, newLevel); - log.WarnFormat("1 - inside OnLevelChange, oldLevel {0}, newLevel {1}, Current maxmana is {2}", oldLevel, newLevel, base.m_activeLiving.MaxMana); + return AtlasRAHelpers.GetPropertyEnhancer3AmountForLevel(level); } + public override int CostForUpgrade(int level) + { + return AtlasRAHelpers.GetCommonUpgradeCostFor5LevelsRA(level); + } } }