[Commands] #tune command rewrite (#1677)

* tune updates

* Update tune.cpp

* tune update

* updates

* updates

* less zero

* update

* up

* u

* Update tune.cpp

* Update tune.cpp

* avoidance working

* accuracy

* save1

* Update tune.cpp

* override

* Removed Old Tune Code

* cleanup1

* up

* finished v1

* Update command.cpp

* Update command.cpp

* spellfix

* Update command.cpp

* remove test command

* added SYNC comments

Hopefully if anyone changes these functions they will change the corresponding tune

* Tune_ to Tune

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
KayenEQ 2021-11-11 20:41:59 -05:00 committed by GitHub
parent 65197ac027
commit 099759c477
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1478 additions and 1026 deletions

View File

@ -59,6 +59,7 @@ extern FastMath g_Math;
extern EntityList entity_list; extern EntityList entity_list;
extern Zone* zone; extern Zone* zone;
//SYNC WITH: tune.cpp, mob.h TuneAttackAnimation
EQ::skills::SkillType Mob::AttackAnimation(int Hand, const EQ::ItemInstance* weapon, EQ::skills::SkillType skillinuse) EQ::skills::SkillType Mob::AttackAnimation(int Hand, const EQ::ItemInstance* weapon, EQ::skills::SkillType skillinuse)
{ {
// Determine animation // Determine animation
@ -163,7 +164,7 @@ EQ::skills::SkillType Mob::AttackAnimation(int Hand, const EQ::ItemInstance* wea
return skillinuse; return skillinuse;
} }
//SYNC WITH: tune.cpp, mob.h Tunecompute_tohit
int Mob::compute_tohit(EQ::skills::SkillType skillinuse) int Mob::compute_tohit(EQ::skills::SkillType skillinuse)
{ {
int tohit = GetSkill(EQ::skills::SkillOffense) + 7; int tohit = GetSkill(EQ::skills::SkillOffense) + 7;
@ -184,6 +185,7 @@ int Mob::compute_tohit(EQ::skills::SkillType skillinuse)
} }
// return -1 in cases that always hit // return -1 in cases that always hit
//SYNC WITH: tune.cpp, mob.h TuneGetTotalToHit
int Mob::GetTotalToHit(EQ::skills::SkillType skill, int chance_mod) int Mob::GetTotalToHit(EQ::skills::SkillType skill, int chance_mod)
{ {
if (chance_mod >= 10000) // override for stuff like SE_SkillAttack if (chance_mod >= 10000) // override for stuff like SE_SkillAttack
@ -247,6 +249,7 @@ int Mob::GetTotalToHit(EQ::skills::SkillType skill, int chance_mod)
// based on dev quotes // based on dev quotes
// the AGI bonus has actually drastically changed from classic // the AGI bonus has actually drastically changed from classic
//SYNC WITH: tune.cpp, mob.h Tunecompute_defense
int Mob::compute_defense() int Mob::compute_defense()
{ {
int defense = GetSkill(EQ::skills::SkillDefense) * 400 / 225; int defense = GetSkill(EQ::skills::SkillDefense) * 400 / 225;
@ -275,6 +278,7 @@ int Mob::compute_defense()
} }
// return -1 in cases that always miss // return -1 in cases that always miss
// SYNC WITH : tune.cpp, mob.h TuneGetTotalDefense()
int Mob::GetTotalDefense() int Mob::GetTotalDefense()
{ {
auto avoidance = compute_defense() + 10; // add 10 in case the NPC's stats are fucked auto avoidance = compute_defense() + 10; // add 10 in case the NPC's stats are fucked
@ -302,6 +306,7 @@ int Mob::GetTotalDefense()
// called when a mob is attacked, does the checks to see if it's a hit // called when a mob is attacked, does the checks to see if it's a hit
// and does other mitigation checks. 'this' is the mob being attacked. // and does other mitigation checks. 'this' is the mob being attacked.
// SYNC WITH : tune.cpp, mob.h TuneCheckHitChance()
bool Mob::CheckHitChance(Mob* other, DamageHitInfo &hit) bool Mob::CheckHitChance(Mob* other, DamageHitInfo &hit)
{ {
#ifdef LUA_EQEMU #ifdef LUA_EQEMU
@ -834,7 +839,7 @@ int Mob::GetClassRaceACBonus()
return ac_bonus; return ac_bonus;
} }
//SYNC WITH: tune.cpp, mob.h TuneACSum
int Mob::ACSum(bool skip_caps) int Mob::ACSum(bool skip_caps)
{ {
int ac = 0; // this should be base AC whenever shrouds come around int ac = 0; // this should be base AC whenever shrouds come around
@ -909,7 +914,7 @@ int Mob::ACSum(bool skip_caps)
} }
int Mob::GetBestMeleeSkill() int Mob::GetBestMeleeSkill()
{ {
int bestSkill=0; int bestSkill=0;
EQ::skills::SkillType meleeSkills[]= EQ::skills::SkillType meleeSkills[]=
@ -931,8 +936,8 @@ int Mob::GetBestMeleeSkill()
} }
return bestSkill; return bestSkill;
} }
//SYNC WITH: tune.cpp, mob.h Tuneoffense
int Mob::offense(EQ::skills::SkillType skill) int Mob::offense(EQ::skills::SkillType skill)
{ {
int offense = GetSkill(skill); int offense = GetSkill(skill);
@ -987,7 +992,7 @@ double Mob::RollD20(int offense, int mitigation)
return mods[index]; return mods[index];
} }
//SYNC WITH: tune.cpp, mob.h TuneMeleeMitigation
void Mob::MeleeMitigation(Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions *opts) void Mob::MeleeMitigation(Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions *opts)
{ {
#ifdef LUA_EQEMU #ifdef LUA_EQEMU
@ -1363,6 +1368,7 @@ int Client::DoDamageCaps(int base_damage)
} }
// other is the defender, this is the attacker // other is the defender, this is the attacker
//SYNC WITH: tune.cpp, mob.h TuneDoAttack
void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts) void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
{ {
if (!other) if (!other)
@ -1420,6 +1426,7 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
//note: throughout this method, setting `damage` to a negative is a way to //note: throughout this method, setting `damage` to a negative is a way to
//stop the attack calculations //stop the attack calculations
// IsFromSpell added to allow spell effects to use Attack. (Mainly for the Rampage AA right now.) // IsFromSpell added to allow spell effects to use Attack. (Mainly for the Rampage AA right now.)
//SYNC WITH: tune.cpp, mob.h TuneClientAttack
bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts) bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts)
{ {
if (!other) { if (!other) {
@ -1989,7 +1996,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, EQ::skills::Skill
parse->EventPlayer(EVENT_DEATH_COMPLETE, this, export_string, 0); parse->EventPlayer(EVENT_DEATH_COMPLETE, this, export_string, 0);
return true; return true;
} }
//SYNC WITH: tune.cpp, mob.h TuneNPCAttack
bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts) bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool IsFromSpell, ExtraAttackOptions *opts)
{ {
if (!other) { if (!other) {

View File

@ -1594,10 +1594,6 @@ public:
uint32 GetLastInvSnapshotTime() { return m_epp.last_invsnapshot_time; } uint32 GetLastInvSnapshotTime() { return m_epp.last_invsnapshot_time; }
uint32 GetNextInvSnapshotTime() { return m_epp.next_invsnapshot_time; } uint32 GetNextInvSnapshotTime() { return m_epp.next_invsnapshot_time; }
//Command #Tune functions
virtual int32 Tune_GetMeleeMitDmg(Mob* GM, Mob *attacker, int32 damage, int32 minhit, float mit_rating, float atk_rating);
int32 GetMeleeDamage(Mob* other, bool GetMinDamage = false);
void QuestReward(Mob* target, uint32 copper = 0, uint32 silver = 0, uint32 gold = 0, uint32 platinum = 0, uint32 itemid = 0, uint32 exp = 0, bool faction = false); void QuestReward(Mob* target, uint32 copper = 0, uint32 silver = 0, uint32 gold = 0, uint32 platinum = 0, uint32 itemid = 0, uint32 exp = 0, bool faction = false);
void QuestReward(Mob* target, const QuestReward_Struct &reward, bool faction); // TODO: Fix faction processing void QuestReward(Mob* target, const QuestReward_Struct &reward, bool faction); // TODO: Fix faction processing

View File

@ -429,7 +429,7 @@ int command_init(void)
command_add("titlesuffix", "[text] [1 = create title table row] - Set your or your player target's title suffix", 50, command_titlesuffix) || command_add("titlesuffix", "[text] [1 = create title table row] - Set your or your player target's title suffix", 50, command_titlesuffix) ||
command_add("traindisc", "[level] - Trains all the disciplines usable by the target, up to level specified. (may freeze client for a few seconds)", 150, command_traindisc) || command_add("traindisc", "[level] - Trains all the disciplines usable by the target, up to level specified. (may freeze client for a few seconds)", 150, command_traindisc) ||
command_add("trapinfo", "- Gets infomation about the traps currently spawned in the zone.", 81, command_trapinfo) || command_add("trapinfo", "- Gets infomation about the traps currently spawned in the zone.", 81, command_trapinfo) ||
command_add("tune", "Calculate ideal statical values related to combat.", 100, command_tune) || command_add("tune", "Calculate statistical values related to combat.", 100, command_tune) ||
command_add("ucs", "- Attempts to reconnect to the UCS server", 0, command_ucs) || command_add("ucs", "- Attempts to reconnect to the UCS server", 0, command_ucs) ||
command_add("undyeme", "- Remove dye from all of your armor slots", 0, command_undyeme) || command_add("undyeme", "- Remove dye from all of your armor slots", 0, command_undyeme) ||
command_add("unfreeze", "- Unfreeze your target", 80, command_unfreeze) || command_add("unfreeze", "- Unfreeze your target", 80, command_unfreeze) ||
@ -14328,53 +14328,108 @@ void command_tune(Client *c, const Seperator *sep)
{ {
//Work in progress - Kayen //Work in progress - Kayen
if(sep->arg[1][0] == '\0' || !strcasecmp(sep->arg[1], "help")) { if (sep->arg[1][0] == '\0' || !strcasecmp(sep->arg[1], "help")) {
c->Message(Chat::White, "Syntax: #tune [subcommand]."); c->Message(Chat::White, "Syntax: #tune [subcommand].");
c->Message(Chat::White, "-- Tune System Commands --"); c->Message(Chat::White, "-- Tune System Commands --");
c->Message(Chat::White, "-- Usage: Returning recommended combat statistical values based on a desired outcome."); c->Message(Chat::White, "-- Usage: Returns recommended combat statistical values based on a desired outcome through simulated combat.");
c->Message(Chat::White, "-- Note: If targeted mob does not have a target (ie not engaged in combat), YOU will be considered the target."); c->Message(Chat::White, "-- This commmand can answer the following difficult questions whening tunings NPCs and Players.");
c->Message(Chat::White, "-- Question: What is the average damage mitigation my AC provides against a specific targets attacks?");
c->Message(Chat::White, "-- Question: What is amount of AC would I need to add to acheive a specific average damage mitigation agianst specific targets attacks?");
c->Message(Chat::White, "-- Question: What is amount of AC would I need to add to my target to acheive a specific average damage mitigation from my attacks?");
c->Message(Chat::White, "-- Question: What is my targets average AC damage mitigation based on my ATK stat?");
c->Message(Chat::White, "-- Question: What is amount of ATK would I need to add to myself to acheive a specific average damage mitigation on my target?");
c->Message(Chat::White, "-- Question: What is amount of ATK would I need to add to my target to acheive a specific average AC damage mitigation on myself?");
c->Message(Chat::White, "-- Question: What is my hit chance against a target?");
c->Message(Chat::White, "-- Question: What is the amount of avoidance I need to add to my target to achieve a specific hit chance?");
c->Message(Chat::White, "-- Question: What is the amount of accuracy I need to add to my target to achieve a specific chance of hitting me?");
c->Message(Chat::White, "-- Question: ... and many more...");
c->Message(Chat::White, " ");
c->Message(Chat::White, "...#tune stats [A/D]");
c->Message(Chat::White, "...#tune FindATK [A/D] [pct mitigation] [interval] [loop_max] [AC override] [Info Level]");
c->Message(Chat::White, "...#tune FindAC [A/D] [pct mitigation] [interval] [loop_max] [ATK override] [Info Level] ");
c->Message(Chat::White, "...#tune FindAccuracy [A/D] [hit chance] [interval] [loop_max] [Avoidance override] [Info Level]");
c->Message(Chat::White, "...#tune FindAvoidance [A/D] [hit chance] [interval] [loop_max] [Accuracy override] [Info Level] ");
c->Message(Chat::White, " ");
c->Message(Chat::White, "-- DETAILS AND EXAMPLES ON USAGE");
c->Message(Chat::White, " ");
c->Message(Chat::White, "...Returns combat statistics, including AC mitigation pct, hit chance, and avoid melee chance for attacker and defender.");
c->Message(Chat::White, "...#tune stats [A/D]");
c->Message(Chat::White, "...");
c->Message(Chat::White, "...Returns recommended ATK adjustment (+/-) on ATTACKER that will result in a specific average AC mitigation pct on DEFENDER. ");
c->Message(Chat::White, "...#tune FindATK [A/D] [pct mitigation] [interval][loop_max][AC override][Info Level]");
c->Message(Chat::White, "...Example: Find the amount of ATK stat I need to add to the targeted NPC so that it hits me for 50 pct damage on average.");
c->Message(Chat::White, "...Example: #tune FindATK D 50");
c->Message(Chat::White, "...");
c->Message(Chat::White, "...Returns recommended AC adjustment(+/-) on DEFENDER for a specific average AC mitigation pct from ATTACKER. ");
c->Message(Chat::White, "...#tune FindAC [A/D] [pct mitigation] [interval][loop_max][ATK override][Info Level] ");
c->Message(Chat::White, "...Example: Find the amount of AC stat I need to add to the targeted NPC so that I hit it for 70 pct damage on average.");
c->Message(Chat::White, "...Example: #tune FindAC D 70");
c->Message(Chat::White, "...");
c->Message(Chat::White, "...Returns recommended Accuracy adjustment (+/-) on ATTACKER that will result in a specific hit chance pct on DEFENDER. ");
c->Message(Chat::White, "...#tune FindAccuracy [A/D] [hit chance] [interval][loop_max][Avoidance override][Info Level]");
c->Message(Chat::White, "...Example: Find the amount of Accuracy stat I need to add to the targeted NPC so that it has a 60 pct hit chance against me.");
c->Message(Chat::White, "...Example: #tune FindAccuracy D 60");
c->Message(Chat::White, "...");
c->Message(Chat::White, "...Returns recommended Avoidance adjustment (+/-) on DEFENDER for in a specific hit chance pct from ATTACKER. ");
c->Message(Chat::White, "...#tune FindAvoidance [A/D] [hit chance] [interval][loop_max][Accuracy override][Info Level] ");
c->Message(Chat::White, "...Example: Find the amount of Avoidance stat I need to add to the targeted NPC so that I have a 30 pct hit chance against it.");
c->Message(Chat::White, "...Example: #tune FindAvoidance D 30");
c->Message(Chat::White, "... ");
c->Message(Chat::White, "...Usage: [A/D] You must input either A or D.");
c->Message(Chat::White, "...Category [A] : YOU are the ATTACKER. YOUR TARGET is the DEFENDER.");
c->Message(Chat::White, "...Category [D] : YOU are the DEFENDER. YOUR TARGET is the ATTACKER.");
c->Message(Chat::White, "...If TARGET is in combat, DEFENDER is the TARGETs TARGET.");
c->Message(Chat::White, " ");
c->Message(Chat::White, "-- Warning: The calculations done in this process are intense and can potentially cause zone crashes depending on parameters set, use with caution!"); c->Message(Chat::White, "-- Warning: The calculations done in this process are intense and can potentially cause zone crashes depending on parameters set, use with caution!");
c->Message(Chat::White, "-- Below are OPTIONAL parameters."); c->Message(Chat::White, "-- Below are OPTIONAL parameters.");
c->Message(Chat::White, "-- Note: [interval] Determines how fast the stat being checked increases/decreases till it finds the best result. Default [ATK/AC 50][Acc/Avoid 10] "); c->Message(Chat::White, "-- Note: [interval] Determines how much the stat being checked increases/decreases till it finds the best result. Lower is more accurate. Default=10");
c->Message(Chat::White, "-- Note: [loop_max] Determines how many iterations are done to increases/decreases the stat till it finds the best result. Default [ATK/AC 100][Acc/Avoid 1000]"); c->Message(Chat::White, "-- Note: [loop_max] Determines how many iterations are done to increases/decreases the stat till it finds the best result. Higher is more accurate. Default=1000");
c->Message(Chat::White, "-- Note: [Stat Override] Will override that stat on mob being checkd with the specified value. Default=0"); c->Message(Chat::White, "-- Note: [Stat Override] Will override that stat on mob being checked with the specified value. Default=0");
c->Message(Chat::White, "-- Note: [Info Level] How much statistical detail is displayed[0 - 3]. Default=0 "); c->Message(Chat::White, "-- Example: If as the attacker you want to find the ATK value you would need to have agianst a target with 1000 AC to achieve an average AC mitigation of 50 pct.");
c->Message(Chat::White, "-- Note: Results are only approximations usually accurate to +/- 2 intervals."); c->Message(Chat::White, "-- Example: #tune FindATK A 50 0 0 1000");
c->Message(Chat::White, "-- Note: [Info Level] How much parsing detail is displayed[0 - 1]. Default: [0] ");
c->Message(Chat::White, "... "); c->Message(Chat::White, " ");
c->Message(Chat::White, "...### Category A ### Target = ATTACKER ### YOU or Target's Target = DEFENDER ###");
c->Message(Chat::White, "...### Category B ### Target = DEFENDER ### YOU or Target's Target = ATTACKER ###");
c->Message(Chat::White, "... ");
c->Message(Chat::White, "...#Returns recommended ATK adjustment +/- on ATTACKER that will result in an average mitigation pct on DEFENDER. ");
c->Message(Chat::White, "...tune FindATK [A/B] [pct mitigation] [interval][loop_max][AC Overwride][Info Level]");
c->Message(Chat::White, "... ");
c->Message(Chat::White, "...#Returns recommended AC adjustment +/- on DEFENDER for an average mitigation pct from ATTACKER. ");
c->Message(Chat::White, "...tune FindAC [A/B] [pct mitigation] [interval][loop_max][ATK Overwride][Info Level] ");
c->Message(Chat::White, "... ");
c->Message(Chat::White, "...#Returns recommended Accuracy adjustment +/- on ATTACKER that will result in a hit chance pct on DEFENDER. ");
c->Message(Chat::White, "...tune FindAccuracy [A/B] [hit chance] [interval][loop_max][Avoidance Overwride][Info Level]");
c->Message(Chat::White, "... ");
c->Message(Chat::White, "...#Returns recommended Avoidance adjustment +/- on DEFENDER for in a hit chance pct from ATTACKER. ");
c->Message(Chat::White, "...tune FindAvoidance [A/B] [pct mitigation] [interval][loop_max][Accuracy Overwride][Info Level] ");
return; return;
} }
//Default is category A for attacker/defender settings, which then are swapped under category B. /*
Mob* defender = c; Category A: YOU are the attacker and your target is the defender
Mob* attacker = c->GetTarget(); Category D: YOU are the defender and your target is the attacker
*/
if (!attacker) Mob* attacker = c;
Mob* defender = c->GetTarget();
if (!defender)
{ {
c->Message(Chat::White, "#Tune - Error no target selected. [#Tune help]"); c->Message(Chat::White, "[#Tune] - Error no target selected. [#Tune help]");
return; return;
} }
//Use if checkings on engaged targets.
Mob* ttarget = attacker->GetTarget(); Mob* ttarget = attacker->GetTarget();
if (ttarget) {
if (ttarget)
defender = ttarget; defender = ttarget;
}
if(!strcasecmp(sep->arg[1], "FindATK")) if (!strcasecmp(sep->arg[1], "stats"))
{
if (!strcasecmp(sep->arg[2], "A")) {
c->TuneGetStats(defender, attacker);
}
else if (!strcasecmp(sep->arg[2], "D")){
c->TuneGetStats(attacker, defender);
}
else {
c->TuneGetStats(defender, attacker);
}
return;
}
if (!strcasecmp(sep->arg[1], "FindATK"))
{ {
float pct_mitigation = atof(sep->arg[3]); float pct_mitigation = atof(sep->arg[3]);
int interval = atoi(sep->arg[4]); int interval = atoi(sep->arg[4]);
@ -14384,32 +14439,48 @@ void command_tune(Client *c, const Seperator *sep)
if (!pct_mitigation) if (!pct_mitigation)
{ {
c->Message(Chat::Red, "#Tune - Error must enter the desired percent mitigation on defender. Ie. Defender to mitigate on average 20 pct of max damage."); c->Message(Chat::White, "[#Tune] - Error must enter the desired percent mitigation on defender.");
c->Message(Chat::White, "...Returns recommended ATK adjustment (+/-) on ATTACKER that will result in a specific average AC mitigation pct on DEFENDER. ");
c->Message(Chat::White, "...#tune FindATK [A/D] [pct mitigation] [interval][loop_max][AC override][Info Level]");
c->Message(Chat::White, "...Example: Find the amount of ATK stat I need to add to the targeted NPC so that it hits me for 50 pct damage on average.");
c->Message(Chat::White, "...Example: #tune FindATK D 50");
return; return;
} }
if (!interval) if (!interval) {
interval = 50; interval = 10;
if (!max_loop) }
max_loop = 100; if (!max_loop) {
if(!ac_override) max_loop = 1000;
}
if (!ac_override) {
ac_override = 0; ac_override = 0;
if (!info_level) }
info_level = 1; if (!info_level) {
info_level = 0;
}
if(!strcasecmp(sep->arg[2], "A")) if (!strcasecmp(sep->arg[2], "A")) {
c->Tune_FindATKByPctMitigation(defender, attacker, pct_mitigation, interval, max_loop,ac_override,info_level); c->TuneGetATKByPctMitigation(defender, attacker, pct_mitigation, interval, max_loop, ac_override, info_level);
else if(!strcasecmp(sep->arg[2], "B")) }
c->Tune_FindATKByPctMitigation(attacker,defender, pct_mitigation, interval, max_loop,ac_override,info_level); else if (!strcasecmp(sep->arg[2], "D")) {
c->TuneGetATKByPctMitigation(attacker, defender, pct_mitigation, interval, max_loop, ac_override, info_level);
}
else { else {
c->Message(Chat::White, "#Tune - Error no category selcted. [#Tune help]"); c->Message(Chat::White, "#Tune - Error no category selcted. [#Tune help]");
c->Message(Chat::White, "Usage #tune FindATK [A/B] [pct mitigation] [interval][loop_max][AC Overwride][Info Level] "); c->Message(Chat::White, "Usage #tune FindATK [A/B] [pct mitigation] [interval][loop_max][AC Overwride][Info Level] ");
c->Message(Chat::White, "Example #tune FindATK A 60"); c->Message(Chat::White, "...Usage: [A/D] You must input either A or D.");
c->Message(Chat::White, "...Category [A] : YOU are the ATTACKER. YOUR TARGET is the DEFENDER.");
c->Message(Chat::White, "...Category [D] : YOU are the DEFENDER. YOUR TARGET is the ATTACKER.");
c->Message(Chat::White, "...If TARGET is in combat, DEFENDER is the TARGETs TARGET.");
c->Message(Chat::White, "... ");
c->Message(Chat::White, "...Example: Find the amount of ATK stat I need to add to the targeted NPC so that it hits me for 50 pct damage on average.");
c->Message(Chat::White, "...Example: #tune FindATK D 50");
} }
return; return;
} }
if(!strcasecmp(sep->arg[1], "FindAC")) if (!strcasecmp(sep->arg[1], "FindAC"))
{ {
float pct_mitigation = atof(sep->arg[3]); float pct_mitigation = atof(sep->arg[3]);
int interval = atoi(sep->arg[4]); int interval = atoi(sep->arg[4]);
@ -14419,33 +14490,49 @@ void command_tune(Client *c, const Seperator *sep)
if (!pct_mitigation) if (!pct_mitigation)
{ {
c->Message(Chat::Red, "#Tune - Error must enter the desired percent mitigation on defender. Ie. Defender to mitigate on average 20 pct of max damage."); c->Message(Chat::White, "#Tune - Error must enter the desired percent mitigation on defender.");
c->Message(Chat::White, "...Returns recommended AC adjustment(+/-) on DEFENDER for a specific average AC mitigation pct from ATTACKER. ");
c->Message(Chat::White, "...#tune FindAC [A/D] [pct mitigation] [interval][loop_max][ATK override][Info Level] ");
c->Message(Chat::White, "...Example: Find the amount of AC stat I need to add to the targeted NPC so that I hit it for 70 pct damage on average.");
c->Message(Chat::White, "...Example: #tune FindAC D 70");
return; return;
} }
if (!interval) if (!interval) {
interval = 50; interval = 10;
if (!max_loop) }
max_loop = 100; if (!max_loop) {
if(!atk_override) max_loop = 1000;
}
if (!atk_override) {
atk_override = 0; atk_override = 0;
if (!info_level) }
info_level = 1; if (!info_level) {
info_level = 0;
}
if(!strcasecmp(sep->arg[2], "A")) if (!strcasecmp(sep->arg[2], "A")) {
c->Tune_FindACByPctMitigation(defender, attacker, pct_mitigation, interval, max_loop,atk_override,info_level); c->TuneGetACByPctMitigation(defender, attacker, pct_mitigation, interval, max_loop, atk_override, info_level);
else if(!strcasecmp(sep->arg[2], "B")) }
c->Tune_FindACByPctMitigation(attacker, defender, pct_mitigation, interval, max_loop,atk_override,info_level); else if (!strcasecmp(sep->arg[2], "D")) {
c->TuneGetACByPctMitigation(attacker, defender, pct_mitigation, interval, max_loop, atk_override, info_level);
}
else { else {
c->Message(Chat::White, "#Tune - Error no category selcted. [#Tune help]"); c->Message(Chat::White, "#Tune - Error no category selcted. [#Tune help]");
c->Message(Chat::White, "Usage #tune FindAC [A/B] [pct mitigation] [interval][loop_max][ATK Overwride][Info Level] "); c->Message(Chat::White, "Usage #tune FindATK [A/B] [pct mitigation] [interval][loop_max][AC Overwride][Info Level] ");
c->Message(Chat::White, "Example #tune FindAC A 60"); c->Message(Chat::White, "...Usage: [A/D] You must input either A or D.");
c->Message(Chat::White, "...Category [A] : YOU are the ATTACKER. YOUR TARGET is the DEFENDER.");
c->Message(Chat::White, "...Category [D] : YOU are the DEFENDER. YOUR TARGET is the ATTACKER.");
c->Message(Chat::White, "...If TARGET is in combat, DEFENDER is the TARGETs TARGET.");
c->Message(Chat::White, "... ");
c->Message(Chat::White, "...Example: Find the amount of AC stat I need to add to the targeted NPC so that I hit it for 70 pct damage on average.");
c->Message(Chat::White, "...Example: #tune FindAC D 70");
} }
return; return;
} }
if(!strcasecmp(sep->arg[1], "FindAccuracy")) if (!strcasecmp(sep->arg[1], "FindAccuracy"))
{ {
float hit_chance = atof(sep->arg[3]); float hit_chance = atof(sep->arg[3]);
int interval = atoi(sep->arg[4]); int interval = atoi(sep->arg[4]);
@ -14455,39 +14542,47 @@ void command_tune(Client *c, const Seperator *sep)
if (!hit_chance) if (!hit_chance)
{ {
c->Message(Chat::NPCQuestSay, "#Tune - Error must enter the desired percent mitigation on defender. Ie. Defender to mitigate on average 20 pct of max damage."); c->Message(Chat::White, "#Tune - Error must enter the desired hit chance on defender.");
c->Message(Chat::White, "...Returns recommended Accuracy adjustment (+/-) on ATTACKER that will result in a specific hit chance pct on DEFENDER. ");
c->Message(Chat::White, "...#tune FindAccuracy [A/D] [hit chance] [interval][loop_max][Avoidance override][Info Level]");
c->Message(Chat::White, "...Example: Find the amount of Accuracy stat I need to add to the targeted NPC so that it has a 60 pct hit chance against me.");
c->Message(Chat::White, "...Example: #tune FindAccuracy D 60");
return; return;
} }
if (!interval) if (!interval) {
interval = 10; interval = 10;
if (!max_loop) }
if (!max_loop) {
max_loop = 1000; max_loop = 1000;
if(!avoid_override) }
if (!avoid_override) {
avoid_override = 0; avoid_override = 0;
if (!info_level) }
info_level = 1; if (!info_level) {
info_level = 0;
if (hit_chance > RuleR(Combat,MaxChancetoHit) || hit_chance < RuleR(Combat,MinChancetoHit))
{
c->Message(Chat::NPCQuestSay, "#Tune - Error hit chance out of bounds. [Max %.2f Min .2f]", RuleR(Combat,MaxChancetoHit),RuleR(Combat,MinChancetoHit));
return;
} }
if(!strcasecmp(sep->arg[2], "A")) if (!strcasecmp(sep->arg[2], "A"))
c->Tune_FindAccuaryByHitChance(defender, attacker, hit_chance, interval, max_loop,avoid_override,info_level); c->TuneGetAccuracyByHitChance(defender, attacker, hit_chance, interval, max_loop, avoid_override, info_level);
else if(!strcasecmp(sep->arg[2], "B")) else if (!strcasecmp(sep->arg[2], "D"))
c->Tune_FindAccuaryByHitChance(attacker, defender, hit_chance, interval, max_loop,avoid_override,info_level); c->TuneGetAccuracyByHitChance(attacker, defender, hit_chance, interval, max_loop, avoid_override, info_level);
else { else {
c->Message(Chat::White, "#Tune - Error no category selcted. [#Tune help]"); c->Message(Chat::White, "#Tune - Error no category selcted. [#Tune help]");
c->Message(Chat::White, "Usage #tune FindAcccuracy [A/B] [hit chance] [interval][loop_max][Avoidance Overwride][Info Level]"); c->Message(Chat::White, "...#tune FindAccuracy [A/D] [hit chance] [interval][loop_max][Avoidance override][Info Level]");
c->Message(Chat::White, "Exampled #tune FindAccuracy B 30"); c->Message(Chat::White, "...Usage: [A/D] You must input either A or D.");
c->Message(Chat::White, "...Category [A] : YOU are the ATTACKER. YOUR TARGET is the DEFENDER.");
c->Message(Chat::White, "...Category [D] : YOU are the DEFENDER. YOUR TARGET is the ATTACKER.");
c->Message(Chat::White, "...If TARGET is in combat, DEFENDER is the TARGETs TARGET.");
c->Message(Chat::White, "... ");
c->Message(Chat::White, "...Example: Find the amount of Accuracy stat I need to add to the targeted NPC so that it has a 60 pct hit chance against me.");
c->Message(Chat::White, "...Example: #tune FindAccuracy D 60");
} }
return; return;
} }
if(!strcasecmp(sep->arg[1], "FindAvoidance")) if (!strcasecmp(sep->arg[1], "FindAvoidance"))
{ {
float hit_chance = atof(sep->arg[3]); float hit_chance = atof(sep->arg[3]);
int interval = atoi(sep->arg[4]); int interval = atoi(sep->arg[4]);
@ -14497,39 +14592,46 @@ void command_tune(Client *c, const Seperator *sep)
if (!hit_chance) if (!hit_chance)
{ {
c->Message(Chat::White, "#Tune - Error must enter the desired hit chance on defender. Ie. Defender to have hit chance of 40 pct."); c->Message(Chat::White, "#Tune - Error must enter the desired hit chance on defender.");
c->Message(Chat::White, "...Returns recommended Avoidance adjustment (+/-) on DEFENDER for in a specific hit chance pct from ATTACKER. ");
c->Message(Chat::White, "...#tune FindAvoidance [A/D] [hit chance] [interval][loop_max][Accuracy override][Info Level] ");
c->Message(Chat::White, "...Example: Find the amount of Avoidance stat I need to add to the targeted NPC so that I have a 30 pct hit chance against it.");
c->Message(Chat::White, "...Example: #tune FindAvoidance D 30");
return; return;
} }
if (!interval) {
if (!interval)
interval = 10; interval = 10;
if (!max_loop) }
if (!max_loop) {
max_loop = 1000; max_loop = 1000;
if(!acc_override) }
if (!acc_override) {
acc_override = 0; acc_override = 0;
if (!info_level) }
info_level = 1; if (!info_level) {
info_level = 0;
if (hit_chance > RuleR(Combat,MaxChancetoHit) || hit_chance < RuleR(Combat,MinChancetoHit))
{
c->Message(Chat::NPCQuestSay, "#Tune - Error hit chance out of bounds. [Max %.2f Min .2f]", RuleR(Combat,MaxChancetoHit),RuleR(Combat,MinChancetoHit));
return;
} }
if(!strcasecmp(sep->arg[2], "A")) if (!strcasecmp(sep->arg[2], "A"))
c->Tune_FindAvoidanceByHitChance(defender, attacker, hit_chance, interval, max_loop,acc_override, info_level); c->TuneGetAvoidanceByHitChance(defender, attacker, hit_chance, interval, max_loop, acc_override, info_level);
else if(!strcasecmp(sep->arg[2], "B")) else if (!strcasecmp(sep->arg[2], "D"))
c->Tune_FindAvoidanceByHitChance(attacker, defender, hit_chance, interval, max_loop,acc_override, info_level); c->TuneGetAvoidanceByHitChance(attacker, defender, hit_chance, interval, max_loop, acc_override, info_level);
else { else {
c->Message(Chat::White, "#Tune - Error no category selcted. [#Tune help]"); c->Message(Chat::White, "#Tune - Error no category selcted. [#Tune help]");
c->Message(Chat::White, "Usage #tune FindAvoidance [A/B] [hit chance] [interval][loop_max][Accuracy Overwride][Info Level]"); c->Message(Chat::White, "...#tune FindAvoidance [A/D] [hit chance] [interval][loop_max][Accuracy override][Info Level] ");
c->Message(Chat::White, "Exampled #tune FindAvoidance B 30"); c->Message(Chat::White, "...Usage: [A/D] You must input either A or D.");
c->Message(Chat::White, "...Category [A] : YOU are the ATTACKER. YOUR TARGET is the DEFENDER.");
c->Message(Chat::White, "...Category [D] : YOU are the DEFENDER. YOUR TARGET is the ATTACKER.");
c->Message(Chat::White, "...If TARGET is in combat, DEFENDER is the TARGETs TARGET.");
c->Message(Chat::White, "... ");
c->Message(Chat::White, "...Example: Find the amount of Avoidance stat I need to add to the targeted NPC so that I have a 30 pct hit chance against it.");
c->Message(Chat::White, "...Example: #tune FindAvoidance D 30");
} }
return; return;
} }
c->Message(Chat::White, "#Tune - Error no command [#Tune help]");
return; return;
} }

View File

@ -1226,14 +1226,38 @@ public:
bool mod_will_aggro(Mob *attacker, Mob *on); bool mod_will_aggro(Mob *attacker, Mob *on);
//Command #Tune functions //Command #Tune functions
int32 Tune_MeleeMitigation(Mob* GM, Mob *attacker, int32 damage, int32 minhit, ExtraAttackOptions *opts = nullptr, int Msg =0, int ac_override=0, int atk_override=0, int add_ac=0, int add_atk = 0); void TuneGetStats(Mob* defender, Mob *attacker);
virtual int32 Tune_GetMeleeMitDmg(Mob* GM, Mob *attacker, int32 damage, int32 minhit, float mit_rating, float atk_rating); void TuneGetACByPctMitigation(Mob* defender, Mob *attacker, float pct_mitigation, int interval = 10, int max_loop = 1000, int atk_override = 0, int Msg = 0);
uint32 Tune_GetMeanDamage(Mob* GM, Mob *attacker, int32 damage, int32 minhit, ExtraAttackOptions *opts = nullptr, int Msg = 0,int ac_override=0, int atk_override=0, int add_ac=0, int add_atk = 0); void TuneGetATKByPctMitigation(Mob* defender, Mob *attacker, float pct_mitigation, int interval = 10, int max_loop = 1000, int ac_override = 0, int Msg = 0);
void Tune_FindATKByPctMitigation(Mob* defender, Mob *attacker, float pct_mitigation, int interval = 50, int max_loop = 100, int ac_override=0,int Msg =0); void TuneGetAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_chance, int interval, int max_loop, int accuracy_override, int Msg);
void Tune_FindACByPctMitigation(Mob* defender, Mob *attacker, float pct_mitigation, int interval = 50, int max_loop = 100, int atk_override=0,int Msg =0); void TuneGetAccuracyByHitChance(Mob* defender, Mob *attacker, float hit_chance, int interval, int max_loop, int avoidance_override, int Msg);
float Tune_CheckHitChance(Mob* defender, Mob* attacker, EQ::skills::SkillType skillinuse, int Hand, int16 chance_mod, int Msg = 1, int acc_override = 0, int avoid_override = 0, int add_acc = 0, int add_avoid = 0); /*support functions*/
void Tune_FindAccuaryByHitChance(Mob* defender, Mob *attacker, float hit_chance, int interval, int max_loop, int avoid_override, int Msg = 0); int TuneClientGetMeanDamage(Mob* other, int ac_override = 0, int atk_override = 0, int add_ac = 0, int add_atk = 0);
void Tune_FindAvoidanceByHitChance(Mob* defender, Mob *attacker, float hit_chance, int interval, int max_loop, int acc_override, int Msg = 0); int TuneClientGetMaxDamage(Mob* other);
int TuneClientGetMinDamage(Mob* other, int max_hit);
float TuneGetACMitigationPct(Mob* defender, Mob *attacker);
int TuneGetOffense(Mob* defender, Mob *attacker, int atk_override = 0);
int TuneGetAccuracy(Mob* defender, Mob *attacker, int accuracy_override = 0, int add_accuracy = 0);
int TuneGetAvoidance(Mob* defender, Mob *attacker, int avoidance_override = 0, int add_avoidance = 0);
float TuneGetHitChance(Mob* defender, Mob *attacker, int avoidance_override = 0, int accuracy_override = 0, int add_avoidance = 0, int add_accuracy = 0);
float TuneGetAvoidMeleeChance(Mob* defender, Mob *attacker, int type);
int TuneCalcEvasionBonus(int final_avoidance, int base_avoidance);
/*modified combat code - These SYNC to attack.cpp, relevant changes to these functions in attack.cpp should be changed to the below as well*/
int TuneNPCAttack(Mob* other, bool no_avoid = true, bool no_hit_chance = true, int hit_chance_bonus = 10000, int ac_override = 0, int atk_override = 0, int add_ac = 0, int add_atk = 0,
bool get_offense = false, bool get_accuracy = false, int avoidance_override = 0, int accuracy_override = 0, int add_avoidance = 0, int add_accuracy = 0);
int TuneClientAttack(Mob* other, bool no_avoid = true, bool no_hit_chance = true, int hit_chance_bonus = 10000, int ac_override = 0, int atk_override = 0, int add_ac = 0, int add_atk = 0,
bool get_offense = false, bool get_accuracy = false, int avoidance_override = 0, int accuracy_override = 0, int add_avoidance = 0, int add_accuracy = 0);
void TuneDoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts = nullptr, bool no_avoid = true, bool no_hit_chance = true, int ac_override = 0, int add_ac = 0,
int avoidance_override = 0, int accuracy_override = 0, int add_avoidance = 0, int add_accuracy = 0);
void TuneMeleeMitigation(Mob *attacker, DamageHitInfo &hit, int ac_override, int add_ac);
int Tuneoffense(EQ::skills::SkillType skill, int atk_override = 0, int add_atk = 0);
int TuneACSum(bool skip_caps=false, int ac_override = 0, int add_ac = 0);
int TuneGetTotalToHit(EQ::skills::SkillType skill, int chance_mod, int accuracy_override = 0, int add_accurracy = 0); // compute_tohit + spell bonuses
int Tunecompute_tohit(EQ::skills::SkillType skillinuse, int accuracy_override = 0, int add_accuracy = 0);
int TuneGetTotalDefense(int avoidance_override = 0, int add_avoidance = 0);
int Tunecompute_defense(int avoidance_override = 0, int add_avoidance = 0);
bool TuneCheckHitChance(Mob* other, DamageHitInfo &hit, int avoidance_override = 0, int add_avoidance = 0);
EQ::skills::SkillType TuneAttackAnimation(int Hand, const EQ::ItemInstance* weapon, EQ::skills::SkillType skillinuse = EQ::skills::Skill1HBlunt);
//aa new //aa new
uint32 GetAA(uint32 rank_id, uint32 *charges = nullptr) const; uint32 GetAA(uint32 rank_id, uint32 *charges = nullptr) const;

File diff suppressed because it is too large Load Diff