mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
Refactor: fixed wrong usage of getSourceObjectIfItStillExists (fixed error "cannot be cast to Permanent");
This commit is contained in:
parent
bfba179bdf
commit
b632d89caa
24 changed files with 26 additions and 26 deletions
|
|
@ -66,7 +66,7 @@ class LicidEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent licid = (Permanent) source.getSourceObjectIfItStillExists(game);
|
||||
Permanent licid = source.getSourcePermanentIfItStillExists(game);
|
||||
if (licid != null) {
|
||||
UUID messageId = UUID.randomUUID();
|
||||
LicidContinuousEffect effect = new LicidContinuousEffect(messageId);
|
||||
|
|
@ -103,7 +103,7 @@ class LicidContinuousEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent licid = (Permanent) source.getSourceObjectIfItStillExists(game);
|
||||
Permanent licid = source.getSourcePermanentIfItStillExists(game);
|
||||
if (licid != null) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class MustBeBlockedByTargetSourceEffect extends RequirementEffect {
|
|||
if (permanent.getId().equals(this.getTargetPointer().getFirst(game, source))) {
|
||||
Permanent blocker = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||
if (blocker != null && blocker.canBlock(source.getSourceId(), game)) {
|
||||
Permanent attacker = (Permanent) source.getSourceObjectIfItStillExists(game);
|
||||
Permanent attacker = source.getSourcePermanentIfItStillExists(game);
|
||||
if (attacker != null) {
|
||||
BlockedAttackerWatcher blockedAttackerWatcher = game.getState().getWatcher(BlockedAttackerWatcher.class);
|
||||
if (blockedAttackerWatcher != null && blockedAttackerWatcher.creatureHasBlockedAttacker(attacker, blocker, game)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue