refactor: improved ContinuousRuleModifying effects:

* removed unused apply methods;
* added miss overrides of checksEventType (related to wrong event usage, see 5f2edde20c).
This commit is contained in:
Oleg Agafonov 2023-09-22 21:32:55 +04:00
parent 5f2edde20c
commit a9152e886f
176 changed files with 279 additions and 1024 deletions

View file

@ -59,24 +59,11 @@ public abstract class ContinuousRuleModifyingEffectImpl extends ContinuousEffect
this.messageToGameLog = effect.messageToGameLog;
}
/**
* An early check for the event types this effect applies to. This check was
* added to speed up event handling. Once all existing
* ContinuousRuleModifiyingEffects have implemented this method, the method
* should be changed to abstract here or removed.
*
* @param event
* @param game
* @return
*/
@Override
public boolean checksEventType(GameEvent event, Game game) {
return true;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
final public boolean apply(Game game, Ability source) {
// not used in rule modifying effects because it allows or disallows related event only without data
// modification or choose dialogs (see applies method)
throw new IllegalStateException("Wrong code usage. Rules modifying effects don't use apply methods");
}
@Override