-
Notifications
You must be signed in to change notification settings - Fork 834
Potential overload rework #14015
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
base: master
Are you sure you want to change the base?
Potential overload rework #14015
Conversation
card.getSpellAbility().addEffect(effect.copy()); | ||
OverloadedEffect overloadEffect = new OverloadedEffect(effect, target.copy()); | ||
overloadEffect.setText(effect.getText(card.getSpellAbility().getModes().getMode()) | ||
.replace("target", "each")); |
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 you don’t use conditional style effect and target (one pair for single and one pair for all)? Auto-replace looks overdeveloped and potentially buggy.
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.
The "all" version of the spell needs to have no target when cast. It sounds to me like you're recommending not continuing this rework and keeping the existing code with its fully separate effects.
The whole point of this rework is to remove the duplicated code by auto-replacing the targets.
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.
Yea, it’s looks strange in current implementation — one shot effect but it can be continues effect inside — thats can broke some effects/targets lifecycle in theory. Not critical and maybe workable.
Also inner effects must support work with target pointers (e.g. each inner effect must have special code to check and use the pointers). Must be carefully replaced and checked.
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 would not call it "special code" as all effects ought to use target pointers as the default, but I agree need to verify each effect properly uses them.
protected OverloadedEffect(final OverloadedEffect effect) { | ||
super(effect); | ||
this.innerEffect = effect.innerEffect; | ||
this.target = effect.target; |
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.
Miss copies
I endorse this direction (just make sure there's adequate test coverage) |
Casting a spell with Overload converts all "target" text to "each". Currently this is done by having entirely separate effects. Instead, we can apply the effects after setting up a
FixedTargets
.I have not yet finished converting all Overload cards, once I do I will remove the old
OverloadAbility
constructor. Currently only A-D cards have been modified. Several of the more complex Overload cards will require merging the target and overload effect implementations as the target version usesgetFirstTarget
.I was wondering if this seemed worth finishing. I don't expect it to fix any bugs, just remove a lot of repetitive code.