-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve multihit move support #590
Conversation
ShivaD173
commented
Dec 11, 2023
•
edited
Loading
edited
- Combine TimesUsed and Multihit to use the same between move function previously used by parental bond
- New/Fixed Effects
- Stamina (fixed)
- Weak Armor (fixed)
- Luminous Moss
- Kee/Maranga Berry
- Water Compaction
- Mummy/Wandering Spirit/Lingering Aroma
- Seed Sower
- Sand Spit
calc/src/mechanics/gen789.ts
Outdated
@@ -621,18 +596,16 @@ export function calculateSMSSSV( | |||
times | |||
); | |||
const newFinalMod = chainMods(newFinalMods, 41, 131072); | |||
const newBaseDamage = calculateBaseDamageSMSSSV( | |||
const basePower = calculateBasePowerSMSSSV( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is shadowing the basePower
defined above.
calc/src/mechanics/gen789.ts
Outdated
); | ||
const newBaseDamage = getBaseDamage(attacker.level, basePower, newAttack, newDefense); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this not using calculateBaseDamage
?
calc/src/mechanics/util.ts
Outdated
(defender.hasItem('Luminous Moss') && move.hasType('Water')) || | ||
(defender.hasItem('Maranga Berry') && move.category === 'Special') || | ||
(defender.hasItem('Kee Berry') && move.category === 'Physical')) { | ||
const defStat = defender.hasAbility('Kee Berry') ? 'def' : 'spd'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const defStat = defender.hasAbility('Kee Berry') ? 'def' : 'spd'; | |
const defStat = defender.hasItem('Kee Berry') ? 'def' : 'spd'; |
calc/src/mechanics/util.ts
Outdated
defender.boosts[defStat] = Math.max(-6, defender.boosts[defStat] - defSimple); | ||
} else { | ||
defender.boosts[defStat] = Math.min(6, defender.boosts[defStat] + defSimple); | ||
if (atkSimple > 1) desc.attackerAbility = attacker.ability; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this condition in the else
block? Shouldn't it be in the description regardless if the ability is Contrary or not? Also, it should just be an equality check.
539f5a7
to
05df464
Compare
This implementation should also accordingly be in the other Also, can you write unit tests? Multihit code is pretty finicky in the Honko engine so having unit tests would be great for sanity sake. |
Updated gen3-9 mechanics files for multihit/multiturn accuracy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fully read through this diff and grokked it so after these are addressed I'll be able to merge after a quick look through. Sorry for the delay.
calc/src/mechanics/util.ts
Outdated
field.weather = 'Sand'; | ||
} | ||
|
||
if (defender.hasAbility('Stamina') && !move.isCrit) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the move being a critical hit matter here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being a critical hit means that the stamina boosts ignore the defense boosts, and therefore stamina should not be showed in the description. Though now I realize that this doesn't work if they start with negative boosts, Will fix.
@@ -1231,7 +1196,7 @@ export function calculateAttackSMSSSV( | |||
attack = attackSource.rawStats[attackStat]; | |||
desc.defenderAbility = defender.ability; | |||
} else { | |||
attack = attackSource.stats[attackStat]; | |||
attack = getModifiedStat(attackSource.rawStats[attackStat]!, attackSource.boosts[attackStat]!); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this line change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Original code gets attack stat modified by on screen boost, new code gets attack modified by boost mid calculation, which would include stuff like superpower drops or PuP boosts.
usedItems = checkMultihitBoost(gen, attacker, defender, move, | ||
field, desc, usedItems[0], usedItems[1]); | ||
const newAtk = calculateAttackBWXY(gen, attacker, defender, move, field, desc, isCritical); | ||
const newDef = calculateDefenseBWXY(gen, attacker, defender, move, field, desc, isCritical); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to recalculate calculateFinalModsBWXY
too so Multiscale works.
calc/src/mechanics/gen789.ts
Outdated
// Hack to make Tera Shell with multihit moves, but not over multiple turns | ||
typeEffectiveness = turn2typeEffectiveness; | ||
} | ||
// Stellar damage boost drops off after first hit, even on multihit moves |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be wrong: https://www.smogon.com/forums/threads/tera-stellar-and-multihit-moves.3737292/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I was implementing it how it was on showdown. Will fix.
Fixed the critical hit problem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ready for merge. I'll merge tomorrow though so any unexpected bugs don't happen on SPL Sunday since this is a decently large diff.
Great work. Thank you! |
Fixes bugs related to Stamina & Weak Armor, and general multihit/multiturn interactions. Also supports the following abilities/items now too: - Luminous Moss - Kee/Maranga Berry - Water Compaction - Mummy/Wandering Spirit/Lingering Aroma - Seed Sower - Sand Spit