Allow inheritance of ability, item, and move conditions#11754
Open
andrebastosdias wants to merge 2 commits intosmogon:masterfrom
Open
Allow inheritance of ability, item, and move conditions#11754andrebastosdias wants to merge 2 commits intosmogon:masterfrom
andrebastosdias wants to merge 2 commits intosmogon:masterfrom
Conversation
Collaborator
|
I was worried about (yet another) no-delete alternativeloadInheritedEntryNew(entryId: string, parentTypedData: DexTable<any>, childTypedData: DexTable<any>) {
// {inherit: true} can be used to modify only parts of the parent data,
// instead of overwriting entirely
const rawChild = childTypedData[entryId];
const childEntry = { ...parentTypedData[entryId] };
// Merge parent and child's entry, with child overwriting parent.
for (const key in rawChild) {
if (key === 'inherit') continue;
if (key === 'condition' && rawChild['condition']?.inherit) {
// 2026 - {inherit: true} can now also be used to inherit parts of conditions
const rawCondition = { ...parentTypedData[entryId].condition };
for (const conditionKey in rawChild['condition']) {
if (conditionKey === 'inherit') continue;
rawCondition[conditionKey] = rawChild['condition'][conditionKey];
}
childEntry['condition'] = rawCondition;
} else {
childEntry[key] = rawChild[key];
}
}
childTypedData[entryId] = childEntry;
} |
Slayer95
approved these changes
Feb 20, 2026
Contributor
|
(FWIW I've been using some somewhat more generic code on ROM for a similar effect: urkerab@6d16206#diff-f54c25b24aeda6549b5d0ab7749fa5f925e1ab3bf9e23404eee1a7ff09fe49f6L532) |
Collaborator
Author
|
@Slayer95 Did you skim through all the changes? |
Collaborator
LGTM. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An extra fix I made was adding the
minimizeflag to moves that deal double damage to minimized targets, so the condition doesn't need to be overwritten every generation.I removed Gen 3 implementation of
basePowerCallbackfor moves that affect Minimize. In reality, they should be implemented inModifyDamagePhase2(very late), but Gen 2 doesn't even implement this event yet. For now, I've left them inModifyDamage, since Generations 1–4 need a damage formula review anyway.Note: one important thing to confirm is that all conditions with
inherit: truemust be attached to effects that also haveinherit: true. Otherwise, it is redundant.Note 2: In the second commit, I went through all the effects that didn't have
inherit: true, meaning they were essentially reimplementing the ability from scratch inside the mod. For some of them, there was literally no reason not to inherit. For others, while it could go either way, I switched to inheritance because it makes it easier to understand why the ability is being overridden in the mod.It is probably easier to review the two commits separably.