From cfd92dc8d5a9b987fac2129aa6c70e410fdc78e6 Mon Sep 17 00:00:00 2001 From: emerald000 Date: Fri, 19 Jun 2015 02:29:16 -0400 Subject: [PATCH] Made TriggeredAbility.checkEventType() abstract. Added missing implementations. --- .../sets/alarareborn/Crystallization.java | 22 ++--- .../sets/alarareborn/DragonAppeasement.java | 14 ++-- .../mage/sets/alarareborn/EnigmaSphinx.java | 36 +++++---- .../src/mage/sets/alarareborn/FinestHour.java | 28 ++++--- .../sets/alarareborn/GloryscaleViashino.java | 23 +++--- .../mage/sets/alarareborn/MycoidShepherd.java | 43 +++++----- .../mage/sets/alarareborn/SigilCaptain.java | 28 ++++--- .../alarareborn/SovereignsOfLostAlara.java | 20 ++--- .../mage/sets/alarareborn/Thraximundar.java | 15 ++-- .../sets/alarareborn/TraceOfAbundance.java | 17 ++-- .../alarareborn/UnscytheKillerOfKings.java | 8 +- .../mage/sets/alarareborn/VedalkenGhoul.java | 8 +- .../src/mage/sets/apocalypse/BogGnarr.java | 20 ++--- .../src/mage/sets/apocalypse/GladeGnarr.java | 22 ++--- .../sets/avacynrestored/ExquisiteBlood.java | 15 ++-- .../sets/avacynrestored/HavengulSkaab.java | 15 ++-- .../sets/avacynrestored/LoneRevenant.java | 9 ++- .../sets/avacynrestored/SpectralPrison.java | 32 ++++---- .../betrayersofkamigawa/JettingGlasskite.java | 14 ++-- .../KamiOfTheHonoredDead.java | 19 +++-- .../KiraGreatGlassSpinner.java | 21 +++-- .../betrayersofkamigawa/MarkOfSakiko.java | 26 +++--- .../betrayersofkamigawa/MistbladeShinobi.java | 15 ++-- .../PatronOfTheNezumi.java | 27 ++++--- .../betrayersofkamigawa/RoninWarclub.java | 44 +++++----- .../SakikoMotherOfSummer.java | 28 ++++--- .../ShimmeringGlasskite.java | 14 ++-- .../ShireiShizosCaretaker.java | 31 +++---- .../betrayersofkamigawa/Skullsnatcher.java | 14 ++-- .../betrayersofkamigawa/ThroatSlitter.java | 15 ++-- .../sets/bornofthegods/PerplexingChimera.java | 8 +- .../mage/sets/bornofthegods/SearingBlood.java | 7 +- .../sets/bornofthegods/SpitefulReturned.java | 35 ++++---- .../championsofkamigawa/AkkiLavarunner.java | 24 +++--- .../championsofkamigawa/AkkiUnderminer.java | 23 +++--- .../championsofkamigawa/GlimpseOfNature.java | 13 ++- .../GodoBanditWarlord.java | 13 ++- .../championsofkamigawa/HorobiDeathsWail.java | 15 ++-- .../sets/championsofkamigawa/KusariGama.java | 21 ++--- .../sets/championsofkamigawa/NaturesWill.java | 10 ++- .../sets/championsofkamigawa/RaggedVeins.java | 29 ++++--- .../SeshiroTheAnointed.java | 21 ++--- .../SosukeSonOfSeshiro.java | 29 ++++--- .../TatsumasaTheDragonsFang.java | 8 +- .../sets/championsofkamigawa/TideOfWar.java | 14 ++-- .../championsofkamigawa/ZoZuThePunisher.java | 25 +++--- .../mage/sets/coldsnap/AdarkarValkyrie.java | 18 +++-- .../sets/coldsnap/DarienKingOfKjeldor.java | 14 +++- .../mage/sets/coldsnap/FuryOfTheHorde.java | 6 ++ .../sets/commander/EdricSpymasterOfTrest.java | 9 ++- .../mage/sets/commander/KaaliaOfTheVast.java | 13 ++- .../src/mage/sets/commander/SewerNemesis.java | 26 +++--- .../mage/sets/commander2013/CurseOfChaos.java | 21 ++--- .../sets/commander2013/CurseOfPredation.java | 35 ++++---- .../commander2013/CurseOfShallowGraves.java | 22 ++--- .../commander2013/CurseOfTheForsaken.java | 35 ++++---- .../DereviEmpyrialTactician.java | 6 ++ .../sets/commander2013/GahijiHonoredOne.java | 31 +++---- .../src/mage/sets/commander2013/Mirari.java | 8 +- .../mage/sets/commander2013/PlagueBoiler.java | 7 +- .../sets/commander2013/Reincarnation.java | 7 +- .../mage/sets/commander2013/SunDroplet.java | 8 +- .../sets/commander2013/WidespreadPanic.java | 15 ++-- .../commander2014/DarettiScrapSavant.java | 23 +++--- .../src/mage/sets/conflux/BloodTyrant.java | 7 +- .../src/mage/sets/conflux/BloodhallOoze.java | 23 ++++-- .../src/mage/sets/conflux/CorruptedRoots.java | 22 ++--- .../src/mage/sets/conflux/FontOfMythos.java | 23 +++--- .../mage/sets/conflux/KederektParasite.java | 13 ++- .../src/mage/sets/conflux/ParasiticStrix.java | 10 ++- .../src/mage/sets/conflux/QuenchableFire.java | 15 ++-- .../src/mage/sets/conflux/SludgeStrider.java | 6 ++ .../src/mage/sets/conspiracy/DackFayden.java | 8 +- .../sets/darkascension/AvacynsCollar.java | 18 +++-- .../sets/darkascension/CurseOfThirst.java | 23 +++--- .../sets/darkascension/DiregrafCaptain.java | 15 ++-- .../sets/darkascension/DrogskolReaver.java | 8 +- .../darkascension/FlayerOfTheHatebound.java | 31 +++---- .../mage/sets/darkascension/HavengulLich.java | 8 +- .../mage/sets/darkascension/Hellrider.java | 24 +++--- .../sets/darkascension/JarOfEyeballs.java | 17 ++-- .../mage/sets/darkascension/Shriekgeist.java | 24 +++--- .../mage/sets/darkascension/SoulSeizer.java | 35 ++++---- .../sets/darkascension/SpitefulShadows.java | 28 ++++--- .../darkascension/TovolarsMagehunter.java | 16 ++-- .../sets/darkascension/WerewolfRansacker.java | 23 ++++-- .../sets/darkascension/WithengarUnbound.java | 15 ++-- .../src/mage/sets/darksteel/LichsTomb.java | 7 +- .../sets/darksteel/SwordOfFireAndIce.java | 28 +++---- .../sets/darksteel/SwordOfLightAndShadow.java | 17 ++-- .../mage/sets/dissension/ProperBurial.java | 15 ++-- .../mage/sets/dissension/UtopiaSprawl.java | 21 ++--- .../src/mage/sets/dragonsmaze/BeckCall.java | 25 +++--- .../mage/sets/dragonsmaze/BredForTheHunt.java | 20 ++--- .../sets/dragonsmaze/CarnageGladiator.java | 27 +++---- .../sets/dragonsmaze/MasterOfCruelties.java | 37 +++++---- .../sets/dragonsmaze/MelekIzzetParagon.java | 15 ++-- .../mage/sets/dragonsmaze/PyrewildShaman.java | 24 +++--- .../mage/sets/dragonsmaze/RenegadeKrasis.java | 19 ++--- .../sets/dragonsmaze/RuricTharTheUnbowed.java | 18 +++-- .../sets/dragonsmaze/VoiceOfResurgence.java | 7 +- .../mage/sets/dragonsmaze/ZhurTaaDruid.java | 19 +++-- .../sets/dragonsoftarkir/ArashinForemost.java | 7 +- .../sets/dragonsoftarkir/FoeRazerRegent.java | 13 ++- .../dragonsoftarkir/RuthlessDeathfang.java | 14 ++-- .../sets/eventide/AshlingTheExtinguisher.java | 33 ++++---- .../src/mage/sets/eventide/Necroskitter.java | 34 ++++---- .../src/mage/sets/eventide/Spitemare.java | 8 +- .../src/mage/sets/eventide/WakeThrasher.java | 16 ++-- .../mage/sets/eventide/WavesOfAggression.java | 6 ++ .../src/mage/sets/exodus/CityOfTraitors.java | 24 +++--- .../mage/sets/exodus/SoltariVisionary.java | 31 +++---- .../src/mage/sets/fallenempires/HighTide.java | 20 +++-- .../src/mage/sets/fifthdawn/BlindCreeper.java | 20 +++-- .../mage/sets/fifthdawn/DawnsReflection.java | 15 ++-- .../mage/sets/fifthdawn/RiteOfPassage.java | 20 +++-- .../src/mage/sets/fifthedition/Blight.java | 27 ++++--- .../src/mage/sets/fifthedition/Justice.java | 35 ++++---- .../src/mage/sets/fourthedition/TheRack.java | 11 ++- .../mage/sets/futuresight/FrenzySliver.java | 18 +++-- .../futuresight/HeartwoodStoryteller.java | 18 +++-- .../sets/gatecrash/AureliaTheWarleader.java | 20 +++-- .../src/mage/sets/gatecrash/CryptGhast.java | 21 ++--- .../sets/gatecrash/DuskmantleGuildmage.java | 31 +++---- .../src/mage/sets/gatecrash/FathomMage.java | 18 ++--- .../mage/sets/gatecrash/FiveAlarmFire.java | 18 +++-- .../mage/sets/gatecrash/GruulRagebeast.java | 33 +++++--- .../sets/gatecrash/HighPriestOfPenance.java | 18 ++--- .../sets/gatecrash/IllusionistsBracers.java | 30 ++++--- .../sets/gatecrash/IncursionSpecialist.java | 15 +++- .../mage/sets/gatecrash/LeylinePhantom.java | 19 +++-- .../sets/gatecrash/ObzedatGhostCouncil.java | 13 ++- .../src/mage/sets/gatecrash/RustScarab.java | 14 ++-- .../src/mage/sets/gatecrash/VerdantHaven.java | 17 ++-- .../mage/sets/gatecrash/VizkopaGuildmage.java | 21 +++-- .../sets/guildpact/BurningTreeShaman.java | 25 +++--- .../sets/guildpact/InkTreaderNephilim.java | 34 ++++---- .../sets/guildpact/SoulsOfTheFaultless.java | 9 ++- .../sets/heroesvsmonsters/DeusOfCalamity.java | 8 +- .../sets/heroesvsmonsters/KavuPredator.java | 8 +- .../mage/sets/iceage/MagusOfTheUnseen.java | 8 +- .../src/mage/sets/iceage/Necropotence.java | 8 +- .../src/mage/sets/iceage/RayOfCommand.java | 9 ++- .../src/mage/sets/iceage/WildGrowth.java | 31 +++---- .../mage/sets/innistrad/BurningVengeance.java | 20 ++--- .../src/mage/sets/innistrad/CreepyDoll.java | 21 ++--- .../src/mage/sets/innistrad/Curiosity.java | 23 +++--- .../mage/sets/innistrad/CurseOfOblivion.java | 26 +++--- .../sets/innistrad/CurseOfStalkedPrey.java | 14 ++-- .../sets/innistrad/CurseOfTheBloodyTome.java | 27 ++++--- .../innistrad/CurseOfThePiercedHeart.java | 26 +++--- .../mage/sets/innistrad/FalkenrathNoble.java | 30 ++++--- .../mage/sets/innistrad/GarrukRelentless.java | 15 ++-- .../sets/innistrad/GrimgrinCorpseBorn.java | 8 +- .../src/mage/sets/innistrad/GutterGrime.java | 38 +++++---- .../mage/sets/innistrad/HomicidalBrute.java | 15 ++-- .../src/mage/sets/innistrad/RakishHeir.java | 32 ++++---- .../sets/innistrad/ReaperFromTheAbyss.java | 18 +++-- .../mage/sets/innistrad/ScreechingBat.java | 22 ++--- .../mage/sets/innistrad/ThrabenSentry.java | 41 +++++----- .../mage/sets/innistrad/VillageCannibals.java | 26 +++--- .../src/mage/sets/innistrad/WoodenStake.java | 49 +++++------ .../sets/jacevsvraska/AeonChronicler.java | 7 +- .../journeyintonyx/AthreosGodOfPassage.java | 22 ++--- .../journeyintonyx/BloodcrazedHoplite.java | 13 +-- .../sets/journeyintonyx/DictateOfKruphix.java | 13 +-- .../EidolonOfTheGreatRevel.java | 18 +++-- .../src/mage/sets/journeyintonyx/Godsend.java | 77 +++++++++--------- .../journeyintonyx/KeranosGodOfStorms.java | 8 +- .../journeyintonyx/KnowledgeAndPower.java | 14 ++-- .../sets/journeyintonyx/MarketFestival.java | 15 ++-- .../sets/journeyintonyx/MortalObstinacy.java | 17 ++-- .../sets/journeyintonyx/SwarmbornGiant.java | 8 +- .../src/mage/sets/legends/Abomination.java | 81 ++++++++++--------- .../src/mage/sets/legions/ToxinSliver.java | 39 ++++----- .../src/mage/sets/legions/WallOfHope.java | 25 +++--- .../mage/sets/limitedalpha/AnkhOfMishra.java | 20 +++-- .../src/mage/sets/limitedalpha/BlackVise.java | 12 +-- .../mage/sets/limitedalpha/Cockatrice.java | 46 ++++++----- .../mage/sets/limitedalpha/CrystalRod.java | 16 ++-- .../src/mage/sets/limitedalpha/DingusEgg.java | 29 ++++--- .../src/mage/sets/limitedalpha/Fastbond.java | 17 ++-- .../src/mage/sets/limitedalpha/IronStar.java | 16 ++-- .../src/mage/sets/limitedalpha/IvoryCup.java | 16 ++-- .../mage/sets/limitedalpha/PsychicVenom.java | 23 +++--- .../sets/limitedalpha/ThicketBasilisk.java | 46 ++++++----- .../mage/sets/limitedalpha/ThroneOfBone.java | 16 ++-- .../mage/sets/limitedalpha/WoodenSphere.java | 16 ++-- Mage.Sets/src/mage/sets/lorwyn/Dread.java | 7 +- .../src/mage/sets/lorwyn/EntanglingTrap.java | 7 +- .../mage/sets/lorwyn/RingsOfBrighthearth.java | 7 +- .../src/mage/sets/magic2010/HowlingMine.java | 18 +++-- .../src/mage/sets/magic2010/IceCage.java | 25 +++--- .../sets/magic2010/LightwielderPaladin.java | 14 ++-- .../src/mage/sets/magic2010/SanguineBond.java | 14 +++- .../mage/sets/magic2011/AjanisPridemate.java | 16 ++-- .../mage/sets/magic2011/ChandrasSpitfire.java | 23 +++--- .../src/mage/sets/magic2011/GraveTitan.java | 11 ++- .../src/mage/sets/magic2011/InfernoTitan.java | 15 ++-- .../mage/sets/magic2011/LilianasCaress.java | 9 ++- .../src/mage/sets/magic2011/PrimalCocoon.java | 38 ++++----- .../src/mage/sets/magic2011/SunTitan.java | 11 ++- .../sets/magic2012/ChandraTheFirebrand.java | 14 +++- .../mage/sets/magic2012/ChandrasPhoenix.java | 23 +++--- .../mage/sets/magic2012/CircleOfFlame.java | 54 +++++++------ .../mage/sets/magic2012/GideonsAvenger.java | 21 ++--- .../mage/sets/magic2012/HuntersInsight.java | 16 ++-- .../sets/magic2012/RitesOfFlourishing.java | 19 +++-- .../mage/sets/magic2012/WarstormSurge.java | 27 ++++--- .../src/mage/sets/magic2012/Worldslayer.java | 25 +++--- .../mage/sets/magic2013/BloodReckoning.java | 53 ++++++------ .../sets/magic2013/HamletbackGoliath.java | 27 ++++--- .../magic2013/NefaroxOverlordOfGrixis.java | 15 ++-- .../sets/magic2013/OdricMasterTactician.java | 25 +++--- .../mage/sets/magic2013/SlumberingDragon.java | 29 ++++--- .../mage/sets/magic2014/ArchangelOfThune.java | 11 ++- .../mage/sets/magic2014/ColossalWhale.java | 8 +- .../mage/sets/magic2014/DoorOfDestinies.java | 22 ++--- .../sets/magic2014/GuardianOfTheAges.java | 24 +++--- .../mage/sets/magic2014/IllusionaryArmor.java | 16 ++-- .../mage/sets/magic2014/PathOfBravery.java | 13 +-- .../mage/sets/magic2014/WindreaderSphinx.java | 15 ++-- .../src/mage/sets/magic2014/Witchstalker.java | 22 ++--- .../src/mage/sets/magic2015/HotSoup.java | 22 ++--- .../sets/magic2015/KurkeshOnakkeAncient.java | 21 ++--- .../sets/magic2015/MilitaryIntelligence.java | 13 +-- .../mage/sets/magic2015/NetcasterSpider.java | 12 +-- .../sets/magic2015/ObNixilisUnshackled.java | 17 ++-- .../mage/sets/magic2015/ProfaneMemento.java | 8 +- .../src/mage/sets/magic2015/SiegeDragon.java | 8 +- .../src/mage/sets/magic2015/WallOfLimbs.java | 8 +- .../src/mage/sets/magic2015/WasteNot.java | 22 ++++- .../sets/mercadianmasques/CausticWasps.java | 8 +- .../mage/sets/mercadianmasques/Larceny.java | 27 ++++--- .../sets/mercadianmasques/NoblePurpose.java | 26 +++--- .../sets/mercadianmasques/PiousWarrior.java | 16 ++-- .../src/mage/sets/mirage/AmberPrison.java | 12 ++- .../src/mage/sets/mirage/RockBasilisk.java | 47 ++++++----- .../src/mage/sets/mirrodin/BansheesBlade.java | 9 +++ .../src/mage/sets/mirrodin/Glimmervoid.java | 21 ++--- .../src/mage/sets/mirrodin/MesmericOrb.java | 16 ++-- .../src/mage/sets/mirrodin/RustmouthOgre.java | 26 +++--- .../src/mage/sets/mirrodin/SwordOfKaldra.java | 24 +++--- .../mirrodinbesieged/ConsecratedSphinx.java | 16 ++-- .../mirrodinbesieged/GlissaTheTraitor.java | 13 ++- .../sets/mirrodinbesieged/KnowledgePool.java | 17 ++-- .../sets/mirrodinbesieged/MagneticMine.java | 27 ++++--- .../sets/mirrodinbesieged/MassacreWurm.java | 13 ++- .../sets/mirrodinbesieged/Mirrorworks.java | 8 +- .../sets/mirrodinbesieged/NestedGhoul.java | 11 ++- .../sets/mirrodinbesieged/Sangromancer.java | 23 ++++-- .../sets/mirrodinbesieged/SepticRats.java | 19 +++-- .../SwordOfFeastAndFamine.java | 31 +++---- .../mirrodinbesieged/ThopterAssembly.java | 8 +- .../sets/mirrodinbesieged/VirulentWound.java | 17 ++-- .../sets/modernmasters/AuntiesSnitch.java | 17 ++-- .../modernmasters/DreamspoilerWitches.java | 15 ++-- .../sets/modernmasters/TrygonPredator.java | 8 +- .../mage/sets/morningtide/GreatbowDoyen.java | 36 +++++---- .../sets/morningtide/OonasBlackguard.java | 7 +- .../mage/sets/newphyrexia/ArmWithAEther.java | 16 ++-- .../mage/sets/newphyrexia/BlindZealot.java | 15 ++-- .../src/mage/sets/newphyrexia/CagedSun.java | 20 ++--- .../newphyrexia/ChancellorOfTheAnnex.java | 14 +++- .../newphyrexia/ChancellorOfTheDross.java | 20 +++-- .../newphyrexia/ChancellorOfTheForge.java | 17 ++-- .../newphyrexia/ChancellorOfTheSpires.java | 16 ++-- .../newphyrexia/ChancellorOfTheTangle.java | 17 ++-- .../sets/newphyrexia/InvaderParasite.java | 13 ++- .../mage/sets/newphyrexia/KarnLiberated.java | 10 ++- .../mage/sets/newphyrexia/NumbingDose.java | 24 +++--- .../newphyrexia/PhyrexianObliterator.java | 13 ++- .../mage/sets/newphyrexia/PsychicSurgery.java | 16 ++-- .../mage/sets/newphyrexia/RageExtractor.java | 14 ++-- .../sets/newphyrexia/ReaperOfSheoldred.java | 13 ++- .../mage/sets/newphyrexia/SuturePriest.java | 13 ++- .../sets/newphyrexia/SwordOfWarAndPeace.java | 29 ++++--- .../newphyrexia/VorinclexVoiceOfHunger.java | 8 +- .../src/mage/sets/ninthedition/Cowardice.java | 19 +++-- .../mage/sets/ninthedition/Deathgazer.java | 39 ++++----- .../src/mage/sets/ninthedition/GravePact.java | 17 ++-- .../sets/ninthedition/GuerrillaTactics.java | 13 +-- .../ninthedition/ViashinoSandstalker.java | 16 ++-- .../src/mage/sets/odyssey/BattleStrain.java | 16 ++-- .../src/mage/sets/odyssey/BombSquad.java | 7 +- .../src/mage/sets/odyssey/DecayingSoil.java | 31 +++---- .../src/mage/sets/odyssey/DruidsCall.java | 20 +++-- .../src/mage/sets/odyssey/FilthyCur.java | 16 ++-- .../src/mage/sets/odyssey/KarmicJustice.java | 7 +- .../src/mage/sets/odyssey/PriceOfGlory.java | 24 +++--- .../src/mage/sets/odyssey/SavageFirecat.java | 17 ++-- .../src/mage/sets/odyssey/SparkMage.java | 40 ++++----- .../src/mage/sets/odyssey/Spiritualize.java | 22 ++--- .../src/mage/sets/odyssey/Standstill.java | 13 +-- .../src/mage/sets/onslaught/FalseCure.java | 18 +++-- .../sets/planarchaos/BenalishCommander.java | 7 +- .../mage/sets/planarchaos/Detritivore.java | 8 +- .../mage/sets/planarchaos/FungalBehemoth.java | 7 +- .../mage/sets/planarchaos/RoilingHorror.java | 7 +- .../planechase2012/PollenbrightWings.java | 31 +++---- .../sets/planeshift/PhyrexianTyranny.java | 17 ++-- .../mage/sets/ravnica/BelltowerSphinx.java | 15 ++-- .../src/mage/sets/ravnica/BreathOfFury.java | 56 +++++++------ .../src/mage/sets/ravnica/TwilightDrover.java | 20 +++-- .../mage/sets/returntoravnica/AshZealot.java | 13 ++- .../sets/returntoravnica/AzorsElocutors.java | 22 ++--- .../sets/returntoravnica/ChronicFlooding.java | 29 ++++--- .../returntoravnica/CrosstownCourier.java | 16 ++-- .../sets/returntoravnica/DeathsPresence.java | 14 ++-- .../sets/returntoravnica/GraveBetrayal.java | 18 +++-- .../JaceArchitectOfThought.java | 31 ++++--- .../mage/sets/returntoravnica/LobberCrew.java | 23 +++--- .../returntoravnica/NecropolisRegent.java | 29 ++++--- .../sets/returntoravnica/Pyroconvergence.java | 20 ++--- .../sets/returntoravnica/SearchTheCity.java | 16 ++-- .../returntoravnica/ShriekingAffliction.java | 15 ++-- .../mage/sets/returntoravnica/SkymarkRoc.java | 13 ++- .../TrostaniSelesnyasVoice.java | 27 ++++--- .../sets/returntoravnica/VolatileRig.java | 15 ++-- .../sets/returntoravnica/VraskaTheUnseen.java | 22 +++-- .../sets/riseoftheeldrazi/AngelheartVial.java | 29 ++++--- .../sets/riseoftheeldrazi/BanefulOmen.java | 31 +++---- .../riseoftheeldrazi/ContaminatedGround.java | 32 ++++---- .../riseoftheeldrazi/CurseOfWizardry.java | 23 +++--- .../riseoftheeldrazi/EmrakulTheAeonsTorn.java | 24 +++--- .../sets/riseoftheeldrazi/GravityWell.java | 75 +++++++++-------- .../LighthouseChronologist.java | 20 ++--- .../sets/riseoftheeldrazi/LightmineField.java | 16 ++-- .../riseoftheeldrazi/MorticianBeetle.java | 14 ++-- .../riseoftheeldrazi/NirkanaRevenant.java | 68 ++++++++-------- .../sets/riseoftheeldrazi/PawnOfUlamog.java | 13 +-- .../riseoftheeldrazi/RaidBombardment.java | 13 ++- .../sets/riseoftheeldrazi/RapaciousOne.java | 14 ++-- .../RenegadeDoppelganger.java | 18 +++-- .../UlamogTheInfiniteGyre.java | 14 ++-- .../mage/sets/riseoftheeldrazi/Vengevine.java | 15 ++-- .../sets/riseoftheeldrazi/WorldAtWar.java | 15 ++-- .../saviorsofkamigawa/EbonyOwlNetsuke.java | 14 ++-- .../ErayoSoratamiAscendant.java | 38 +++++---- .../KiyomaroFirstToStand.java | 19 +++-- .../saviorsofkamigawa/PureIntentions.java | 22 +++-- .../sets/scarsofmirrodin/CopperhornScout.java | 18 +++-- .../scarsofmirrodin/DissipationField.java | 13 ++- .../sets/scarsofmirrodin/EzurisArchers.java | 19 ++--- .../scarsofmirrodin/FurnaceCelebration.java | 17 ++-- .../sets/scarsofmirrodin/GolemsHeart.java | 21 ++--- .../scarsofmirrodin/InfiltrationLens.java | 26 +++--- .../sets/scarsofmirrodin/KothOfTheHammer.java | 14 +++- .../scarsofmirrodin/LiegeOfTheTangle.java | 32 ++++---- .../sets/scarsofmirrodin/LivewireLash.java | 17 ++-- .../mage/sets/scarsofmirrodin/MimicVat.java | 50 ++++++------ .../sets/scarsofmirrodin/MolderBeast.java | 25 +++--- .../scarsofmirrodin/MoltenTailMasticore.java | 8 +- .../sets/scarsofmirrodin/NimDeathmantle.java | 53 ++++++------ .../sets/scarsofmirrodin/OgreGeargrabber.java | 21 ++--- .../sets/scarsofmirrodin/PrecursorGolem.java | 30 +++---- .../scarsofmirrodin/RelicPutrescence.java | 22 ++--- .../scarsofmirrodin/SwordOfBodyAndMind.java | 35 ++++---- .../sets/scarsofmirrodin/TunnelIgnus.java | 33 ++++---- .../scarsofmirrodin/VenserTheSojourner.java | 17 ++-- .../sets/scarsofmirrodin/VigilForTheLost.java | 16 ++-- .../sets/scarsofmirrodin/ViridianRevel.java | 13 ++- .../mage/sets/scourge/PyrostaticPillar.java | 19 +++-- .../src/mage/sets/scourge/XantidSwarm.java | 8 +- .../mage/sets/seventhedition/AEtherFlash.java | 22 ++--- .../sets/seventhedition/FinalFortune.java | 13 +-- .../seventhedition/RelentlessAssault.java | 7 ++ .../src/mage/sets/seventhedition/Rowen.java | 8 +- .../mage/sets/shadowmoor/AshenmoorLiege.java | 7 +- .../sets/shadowmoor/DemigodOfRevenge.java | 11 ++- .../sets/shadowmoor/FlourishingDefenses.java | 9 ++- .../sets/shadowmoor/HollowbornBarghest.java | 8 +- .../mage/sets/shadowmoor/RakingCanopy.java | 24 +++--- .../mage/sets/shadowmoor/SpitefulVisions.java | 13 ++- .../src/mage/sets/shadowmoor/TowerAbove.java | 9 ++- .../shardsofalara/AngelicBenediction.java | 13 ++- .../sets/shardsofalara/BattlegraceAngel.java | 7 +- .../sets/shardsofalara/CradleOfVitality.java | 15 ++-- .../mage/sets/shardsofalara/Drumhunter.java | 12 ++- .../shardsofalara/ExuberantFirestoker.java | 17 ++-- .../mage/sets/shardsofalara/Manaplasm.java | 27 ++++--- .../sets/shardsofalara/MemoryErosion.java | 21 ++--- .../sets/shardsofalara/MightyEmergence.java | 29 ++++--- .../sets/shardsofalara/PrinceOfThralls.java | 31 +++---- .../mage/sets/shardsofalara/QuietusSpike.java | 30 ++++--- .../sets/shardsofalara/RafiqOfTheMany.java | 7 +- .../mage/sets/shardsofalara/Skeletonize.java | 27 ++++--- .../sets/shardsofalara/SunseedNurturer.java | 17 ++-- .../src/mage/sets/stronghold/HornOfGreed.java | 13 +-- .../src/mage/sets/stronghold/Overgrowth.java | 20 +++-- .../mage/sets/stronghold/SacredGround.java | 12 +-- .../mage/sets/stronghold/WallOfEssence.java | 9 ++- .../sets/tempestremastered/CoffinQueen.java | 8 +- .../sets/tempestremastered/Spellshock.java | 18 +++-- .../sets/tempestremastered/WallOfSouls.java | 9 ++- .../mage/sets/tenthedition/AngelsFeather.java | 20 ++--- .../mage/sets/tenthedition/KrakensEye.java | 20 ++--- .../src/mage/sets/tenthedition/Megrim.java | 14 +++- .../mage/sets/tenthedition/WurmsTooth.java | 20 ++--- Mage.Sets/src/mage/sets/thedark/Venom.java | 53 ++++++------ .../src/mage/sets/theros/BidentOfThassa.java | 17 ++-- .../mage/sets/theros/FlamespeakerAdept.java | 10 ++- .../sets/theros/RescueFromTheUnderworld.java | 17 +++- .../src/mage/sets/theros/ThassasEmissary.java | 9 ++- .../src/mage/sets/theros/TimeToFeed.java | 8 +- .../src/mage/sets/theros/TritonTactics.java | 8 +- .../mage/sets/timeshifted/EssenceSliver.java | 25 +++--- .../mage/sets/timeshifted/GrinningTotem.java | 8 +- .../timeshifted/SolkanarTheSwampKing.java | 21 +++-- .../mage/sets/timespiral/GauntletOfPower.java | 70 ++++++++-------- .../mage/sets/timespiral/NorinTheWary.java | 14 ++-- .../src/mage/sets/timespiral/ParadoxHaze.java | 22 ++--- .../sets/timespiral/SaffiEriksdotter.java | 10 ++- .../src/mage/sets/timespiral/StuffyDoll.java | 16 ++-- .../mage/sets/urzasdestiny/AetherSting.java | 15 ++-- .../sets/urzasdestiny/PhyrexianNegator.java | 20 +++-- .../urzasdestiny/RayneAcademyChancellor.java | 25 +++--- .../src/mage/sets/urzaslegacy/MemoryJar.java | 19 ++--- .../src/mage/sets/urzaslegacy/NoMercy.java | 36 +++++---- .../src/mage/sets/urzaslegacy/Rivalry.java | 22 ++--- .../src/mage/sets/urzaslegacy/Scrapheap.java | 23 +++--- .../src/mage/sets/urzassaga/Bereavement.java | 14 +++- .../mage/sets/urzassaga/CarpetOfFlowers.java | 13 +-- .../sets/urzassaga/DiabolicServitude.java | 8 +- .../mage/sets/urzassaga/FertileGround.java | 10 ++- .../src/mage/sets/urzassaga/GoblinLackey.java | 21 ++--- .../mage/sets/urzassaga/SpreadingAlgae.java | 23 +++--- .../src/mage/sets/urzassaga/ThranQuarry.java | 20 ++--- .../mage/sets/urzassaga/TitaniasChosen.java | 20 ++--- .../vintagemasters/MarchesaTheBlackRose.java | 9 ++- .../vintagemasters/ScourgeOfTheThrone.java | 52 ++++++------ .../mage/sets/vintagemasters/SpinalGraft.java | 20 +++-- .../src/mage/sets/visions/Necromancy.java | 14 ++-- .../mage/sets/weatherlight/GoblinVandal.java | 28 ++++--- .../mage/sets/worldwake/AmuletOfVigor.java | 24 +++--- .../sets/worldwake/ArchonOfRedemption.java | 31 +++---- .../mage/sets/worldwake/BrinkOfDisaster.java | 23 +++--- .../src/mage/sets/worldwake/HammerOfRuin.java | 39 ++++----- .../sets/worldwake/KalastriaHighborn.java | 30 +++---- .../worldwake/KazuulTyrantOfTheCliffs.java | 26 +++--- .../mage/sets/worldwake/KorFirewalker.java | 21 ++--- .../mage/sets/worldwake/PerimeterCaptain.java | 21 ++--- .../sets/worldwake/QuestForTheNihilStone.java | 24 +++--- .../sets/worldwake/QuestForUlasTemple.java | 22 +++-- .../sets/worldwake/RumblingAftershocks.java | 48 +++++------ .../mage/sets/worldwake/SlaveringNulls.java | 14 ++-- .../src/mage/sets/worldwake/TalusPaladin.java | 31 +++---- .../sets/zendikar/BladeOfTheBloodchief.java | 45 ++++++----- .../src/mage/sets/zendikar/BloodSeeker.java | 19 +++-- .../mage/sets/zendikar/CelestialMantle.java | 24 +++--- .../mage/sets/zendikar/CosisTrickster.java | 17 ++-- .../mage/sets/zendikar/Electropotence.java | 26 +++--- .../mage/sets/zendikar/EmeriaTheSkyRuin.java | 20 ++--- .../src/mage/sets/zendikar/GoblinGuide.java | 15 ++-- .../mage/sets/zendikar/LullmageMentor.java | 23 +++--- .../sets/zendikar/LuminarchAscension.java | 59 +++++++------- .../src/mage/sets/zendikar/MireBlight.java | 26 +++--- .../src/mage/sets/zendikar/PunishingFire.java | 17 ++-- .../mage/sets/zendikar/QuestForPureFlame.java | 9 ++- .../sets/zendikar/QuestForTheGemblades.java | 22 ++--- .../src/mage/sets/zendikar/ScuteMob.java | 16 ++-- .../zendikar/ValakutTheMoltenPinnacle.java | 19 +++-- .../mage/sets/zendikar/WarrenInstigator.java | 21 ++--- .../mage/abilities/TriggeredAbilityImpl.java | 4 +- 464 files changed, 5501 insertions(+), 3845 deletions(-) diff --git a/Mage.Sets/src/mage/sets/alarareborn/Crystallization.java b/Mage.Sets/src/mage/sets/alarareborn/Crystallization.java index 89ec238a68..66af16ece1 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/Crystallization.java +++ b/Mage.Sets/src/mage/sets/alarareborn/Crystallization.java @@ -32,8 +32,8 @@ import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.AttachEffect; -import mage.abilities.effects.common.combat.CantAttackBlockAttachedEffect; import mage.abilities.effects.common.ExileTargetEffect; +import mage.abilities.effects.common.combat.CantAttackBlockAttachedEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; import mage.constants.AttachmentType; @@ -43,6 +43,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; @@ -101,17 +102,20 @@ class CrystallizationTriggeredAbility extends TriggeredAbilityImpl { public CrystallizationTriggeredAbility copy() { return new CrystallizationTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TARGETED; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TARGETED) { - Permanent enchantment = game.getPermanent(sourceId); - if (enchantment != null && enchantment.getAttachedTo() != null) { - UUID enchanted = enchantment.getAttachedTo(); - if (event.getTargetId().equals(enchanted)) { - getEffects().get(0).setTargetPointer(new FixedTarget(enchanted)); - return true; - } + Permanent enchantment = game.getPermanent(sourceId); + if (enchantment != null && enchantment.getAttachedTo() != null) { + UUID enchanted = enchantment.getAttachedTo(); + if (event.getTargetId().equals(enchanted)) { + getEffects().get(0).setTargetPointer(new FixedTarget(enchanted)); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/alarareborn/DragonAppeasement.java b/Mage.Sets/src/mage/sets/alarareborn/DragonAppeasement.java index 6f7d65cb1b..5ee8ca52d9 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/DragonAppeasement.java +++ b/Mage.Sets/src/mage/sets/alarareborn/DragonAppeasement.java @@ -38,6 +38,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -86,14 +87,15 @@ class DragonAppeasementTriggeredAbility extends TriggeredAbilityImpl { return new DragonAppeasementTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SACRIFICED_PERMANENT; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT - && event.getPlayerId().equals(this.getControllerId()) - && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getCardType().contains(CardType.CREATURE)) { - return true; - } - return false; + return event.getPlayerId().equals(this.getControllerId()) + && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getCardType().contains(CardType.CREATURE); } @Override diff --git a/Mage.Sets/src/mage/sets/alarareborn/EnigmaSphinx.java b/Mage.Sets/src/mage/sets/alarareborn/EnigmaSphinx.java index 819fd8fda9..7cc940a7bf 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/EnigmaSphinx.java +++ b/Mage.Sets/src/mage/sets/alarareborn/EnigmaSphinx.java @@ -28,10 +28,6 @@ package mage.sets.alarareborn; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -41,8 +37,13 @@ import mage.abilities.keyword.CascadeAbility; import mage.abilities.keyword.FlyingAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.players.Library; @@ -101,20 +102,23 @@ class EnigmaSphinxTriggeredAbility extends TriggeredAbilityImpl { return new EnigmaSphinxTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - Permanent permanent = zEvent.getTarget(); - if (permanent != null && - zEvent.getToZone() == Zone.GRAVEYARD && - zEvent.getFromZone() == Zone.BATTLEFIELD && - permanent.getId().equals(this.getSourceId()) && - // 5/1/2009 If you control an Enigma Sphinx that's owned by another player, it's put into that player's - // graveyard from the battlefield, so Enigma Sphinx's middle ability won't trigger. - permanent.getOwnerId().equals(permanent.getControllerId())) { - return true; - } + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + Permanent permanent = zEvent.getTarget(); + if (permanent != null && + zEvent.getToZone() == Zone.GRAVEYARD && + zEvent.getFromZone() == Zone.BATTLEFIELD && + permanent.getId().equals(this.getSourceId()) && + // 5/1/2009 If you control an Enigma Sphinx that's owned by another player, it's put into that player's + // graveyard from the battlefield, so Enigma Sphinx's middle ability won't trigger. + permanent.getOwnerId().equals(permanent.getControllerId())) { + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/alarareborn/FinestHour.java b/Mage.Sets/src/mage/sets/alarareborn/FinestHour.java index 6bc9d7e20f..6680bd1cd1 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/FinestHour.java +++ b/Mage.Sets/src/mage/sets/alarareborn/FinestHour.java @@ -29,23 +29,22 @@ package mage.sets.alarareborn; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.TurnPhase; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.ExaltedAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TurnPhase; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.turn.TurnMod; -import mage.target.common.TargetCreaturePermanent; import mage.target.targetpointer.FixedTarget; /** @@ -95,16 +94,19 @@ class FinestHourAbility extends TriggeredAbilityImpl { return new FinestHourAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (checkInterveningIfClause(game) && game.getActivePlayerId().equals(this.controllerId)) { - if (event.getType() == EventType.DECLARED_ATTACKERS) { - if (game.getCombat().attacksAlone()) { - for (Effect effect: this.getEffects()) { - effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0))); - } - return true; + if (game.getActivePlayerId().equals(this.controllerId)) { + if (game.getCombat().attacksAlone()) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0))); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/alarareborn/GloryscaleViashino.java b/Mage.Sets/src/mage/sets/alarareborn/GloryscaleViashino.java index 46d20e93bb..7d87143fc8 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/GloryscaleViashino.java +++ b/Mage.Sets/src/mage/sets/alarareborn/GloryscaleViashino.java @@ -29,16 +29,17 @@ package mage.sets.alarareborn; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; /** @@ -85,15 +86,15 @@ class GloryscaleViashinoAbility extends TriggeredAbilityImpl { return new GloryscaleViashinoAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).isMulticolored() && event.getPlayerId().equals(getControllerId())) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getColor(game).isMulticolored() && event.getPlayerId().equals(getControllerId()); } @Override diff --git a/Mage.Sets/src/mage/sets/alarareborn/MycoidShepherd.java b/Mage.Sets/src/mage/sets/alarareborn/MycoidShepherd.java index b3227fb701..5f68c93393 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/MycoidShepherd.java +++ b/Mage.Sets/src/mage/sets/alarareborn/MycoidShepherd.java @@ -28,17 +28,17 @@ package mage.sets.alarareborn; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.MageObject; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; @@ -83,24 +83,27 @@ class MycoidShepherdTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - MageObject lastKnown = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (lastKnown == null) { - return false; - } - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - Permanent permanent = zEvent.getTarget(); - if (permanent == null) { - return false; - } - if (super.getSourceId().equals(event.getTargetId()) - || permanent.getPower().getValue() > 4 - && permanent.getControllerId().equals(controllerId)) { - Zone after = game.getState().getZone(event.getTargetId()); - return after != null && Zone.GRAVEYARD.match(after); - } + MageObject lastKnown = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + if (lastKnown == null) { + return false; + } + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + Permanent permanent = zEvent.getTarget(); + if (permanent == null) { + return false; + } + if (super.getSourceId().equals(event.getTargetId()) + || permanent.getPower().getValue() > 4 + && permanent.getControllerId().equals(controllerId)) { + Zone after = game.getState().getZone(event.getTargetId()); + return after != null && Zone.GRAVEYARD.match(after); } return false; } diff --git a/Mage.Sets/src/mage/sets/alarareborn/SigilCaptain.java b/Mage.Sets/src/mage/sets/alarareborn/SigilCaptain.java index 0228977443..fa3a33e7ef 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/SigilCaptain.java +++ b/Mage.Sets/src/mage/sets/alarareborn/SigilCaptain.java @@ -39,6 +39,7 @@ import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -83,21 +84,24 @@ class SigilCaptainTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent == null) { - return false; - } - if (permanent.getControllerId().equals(controllerId) - && permanent.getPower().getValue() == 1 - && permanent.getToughness().getValue() == 1) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - } - return true; + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent == null) { + return false; + } + if (permanent.getControllerId().equals(controllerId) + && permanent.getPower().getValue() == 1 + && permanent.getToughness().getValue() == 1) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/alarareborn/SovereignsOfLostAlara.java b/Mage.Sets/src/mage/sets/alarareborn/SovereignsOfLostAlara.java index 6040747041..f6f70200a1 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/SovereignsOfLostAlara.java +++ b/Mage.Sets/src/mage/sets/alarareborn/SovereignsOfLostAlara.java @@ -28,10 +28,6 @@ package mage.sets.alarareborn; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -39,7 +35,10 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.ExaltedAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.other.AuraCardCanAttachToPermanentId; @@ -99,14 +98,17 @@ class CreatureControlledAttacksAloneTriggeredAbility extends TriggeredAbilityImp return new CreatureControlledAttacksAloneTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (game.getActivePlayerId().equals(this.controllerId)) { - if (event.getType() == EventType.DECLARED_ATTACKERS) { - if (game.getCombat().attacksAlone()) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0))); - return true; - } + if (game.getCombat().attacksAlone()) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0))); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/alarareborn/Thraximundar.java b/Mage.Sets/src/mage/sets/alarareborn/Thraximundar.java index 3028eded66..9fe05560f0 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/Thraximundar.java +++ b/Mage.Sets/src/mage/sets/alarareborn/Thraximundar.java @@ -44,6 +44,7 @@ import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -139,15 +140,15 @@ class PlayerSacrificesCreatureTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SACRIFICED_PERMANENT; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT) { - MageObject mageObject = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (mageObject != null && mageObject.getCardType().contains(CardType.CREATURE)) { - return true; - } - } - return false; + MageObject mageObject = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + return mageObject != null && mageObject.getCardType().contains(CardType.CREATURE); } @Override diff --git a/Mage.Sets/src/mage/sets/alarareborn/TraceOfAbundance.java b/Mage.Sets/src/mage/sets/alarareborn/TraceOfAbundance.java index 5edada9ccb..388649436c 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/TraceOfAbundance.java +++ b/Mage.Sets/src/mage/sets/alarareborn/TraceOfAbundance.java @@ -28,18 +28,15 @@ package mage.sets.alarareborn; import java.util.UUID; -import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.AddManaAnyColorAttachedControllerEffect; import mage.abilities.effects.common.AttachEffect; -import mage.abilities.effects.common.ManaEffect; import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.ShroudAbility; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; -import mage.choices.ChoiceColor; import mage.constants.AttachmentType; import mage.constants.CardType; import mage.constants.Duration; @@ -48,8 +45,8 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; -import mage.players.Player; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; @@ -109,15 +106,15 @@ class TraceOfAbundanceTriggeredAbility extends TriggeredManaAbility { return new TraceOfAbundanceTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); - if (event.getType() == GameEvent.EventType.TAPPED_FOR_MANA) { - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - return true; - } - } - return false; + return enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo()); } @Override diff --git a/Mage.Sets/src/mage/sets/alarareborn/UnscytheKillerOfKings.java b/Mage.Sets/src/mage/sets/alarareborn/UnscytheKillerOfKings.java index b4bf3105dd..b89373ee45 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/UnscytheKillerOfKings.java +++ b/Mage.Sets/src/mage/sets/alarareborn/UnscytheKillerOfKings.java @@ -48,6 +48,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.game.permanent.token.ZombieToken; @@ -103,9 +104,14 @@ class UnscytheKillerOfKingsTriggeredAbility extends TriggeredAbilityImpl { return new UnscytheKillerOfKingsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { + if (((ZoneChangeEvent) event).isDiesEvent()) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getTarget().getCardType().contains(CardType.CREATURE)) { // target token can't create Zombie Permanent equipment = game.getPermanent(getSourceId()); diff --git a/Mage.Sets/src/mage/sets/alarareborn/VedalkenGhoul.java b/Mage.Sets/src/mage/sets/alarareborn/VedalkenGhoul.java index f69fcb53d0..ddd5bc5676 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/VedalkenGhoul.java +++ b/Mage.Sets/src/mage/sets/alarareborn/VedalkenGhoul.java @@ -38,6 +38,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -82,9 +83,14 @@ class VedalkenGhoulTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.CREATURE_BLOCKED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.CREATURE_BLOCKED && event.getTargetId().equals(this.getSourceId())) { + if (event.getTargetId().equals(this.getSourceId())) { UUID defendingPlayer = game.getCombat().getDefenderId(this.getSourceId()); if (defendingPlayer != null) { for (Effect effect : this.getEffects()) { diff --git a/Mage.Sets/src/mage/sets/apocalypse/BogGnarr.java b/Mage.Sets/src/mage/sets/apocalypse/BogGnarr.java index 303c2e9131..efc75cfd61 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/BogGnarr.java +++ b/Mage.Sets/src/mage/sets/apocalypse/BogGnarr.java @@ -29,20 +29,20 @@ package mage.sets.apocalypse; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.ObjectColor; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; /** @@ -87,15 +87,15 @@ class BogGnarrTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && filter.match(spell, game)) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && filter.match(spell, game); } @Override diff --git a/Mage.Sets/src/mage/sets/apocalypse/GladeGnarr.java b/Mage.Sets/src/mage/sets/apocalypse/GladeGnarr.java index 537e1291d3..4ff643a49d 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/GladeGnarr.java +++ b/Mage.Sets/src/mage/sets/apocalypse/GladeGnarr.java @@ -27,23 +27,23 @@ */ package mage.sets.apocalypse; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; -import java.util.UUID; - /** * @author Loki */ @@ -85,15 +85,15 @@ class GladeGnarrTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && filter.match(spell, game)) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && filter.match(spell, game); } @Override diff --git a/Mage.Sets/src/mage/sets/avacynrestored/ExquisiteBlood.java b/Mage.Sets/src/mage/sets/avacynrestored/ExquisiteBlood.java index 14fb15e506..3dae9353e9 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/ExquisiteBlood.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/ExquisiteBlood.java @@ -27,16 +27,16 @@ */ package mage.sets.avacynrestored; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; - -import java.util.UUID; +import mage.game.events.GameEvent.EventType; /** * @author noxx @@ -78,9 +78,14 @@ class ExquisiteBloodTriggeredAbility extends TriggeredAbilityImpl { return new ExquisiteBloodTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.LOST_LIFE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.LOST_LIFE && game.getOpponents(this.controllerId).contains(event.getPlayerId())) { + if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) { this.getEffects().clear(); this.addEffect(new GainLifeEffect(event.getAmount())); return true; diff --git a/Mage.Sets/src/mage/sets/avacynrestored/HavengulSkaab.java b/Mage.Sets/src/mage/sets/avacynrestored/HavengulSkaab.java index b4bbb83691..68e82eb0f9 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/HavengulSkaab.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/HavengulSkaab.java @@ -27,22 +27,22 @@ */ package mage.sets.avacynrestored; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetControlledCreaturePermanent; -import java.util.UUID; - /** * * @author noxx @@ -89,9 +89,14 @@ class HavengulSkaabAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { + if (event.getSourceId().equals(this.getSourceId())) { TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, filter, false); this.addTarget(target); return true; diff --git a/Mage.Sets/src/mage/sets/avacynrestored/LoneRevenant.java b/Mage.Sets/src/mage/sets/avacynrestored/LoneRevenant.java index 515e0e80d7..0024d46d9c 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/LoneRevenant.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/LoneRevenant.java @@ -42,6 +42,7 @@ import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -91,10 +92,14 @@ class LoneRevenantTriggeredAbility extends TriggeredAbilityImpl { return new LoneRevenantTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId) - && ((DamagedPlayerEvent) event).isCombatDamage()) { + if (event.getSourceId().equals(this.sourceId) && ((DamagedPlayerEvent) event).isCombatDamage()) { Permanent permanent = game.getPermanent(event.getSourceId()); int number = game.getBattlefield().countAll(filter, controllerId, game); diff --git a/Mage.Sets/src/mage/sets/avacynrestored/SpectralPrison.java b/Mage.Sets/src/mage/sets/avacynrestored/SpectralPrison.java index 244365d90a..7923ce030b 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/SpectralPrison.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/SpectralPrison.java @@ -27,9 +27,8 @@ */ package mage.sets.avacynrestored; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.abilities.Ability; +import java.util.UUID; +import mage.MageObject; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.AttachEffect; @@ -37,18 +36,18 @@ import mage.abilities.effects.common.DestroySourceEffect; import mage.abilities.effects.common.DontUntapInControllersUntapStepEnchantedEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; +import mage.game.stack.Spell; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; -import java.util.UUID; -import mage.MageObject; -import mage.game.stack.Spell; - /** * * @author noxx @@ -99,16 +98,19 @@ class SpectralPrisonAbility extends TriggeredAbilityImpl { return new SpectralPrisonAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TARGETED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TARGETED) { - MageObject eventSourceObject = game.getObject(event.getSourceId()); - if (eventSourceObject != null && eventSourceObject instanceof Spell) { - Permanent enchantment = game.getPermanent(sourceId); - if (enchantment != null && enchantment.getAttachedTo() != null) { - if (event.getTargetId().equals(enchantment.getAttachedTo())) { - return true; - } + MageObject eventSourceObject = game.getObject(event.getSourceId()); + if (eventSourceObject != null && eventSourceObject instanceof Spell) { + Permanent enchantment = game.getPermanent(sourceId); + if (enchantment != null && enchantment.getAttachedTo() != null) { + if (event.getTargetId().equals(enchantment.getAttachedTo())) { + return true; } } } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/JettingGlasskite.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/JettingGlasskite.java index 7c265a37ce..992fc08f1a 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/JettingGlasskite.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/JettingGlasskite.java @@ -28,14 +28,14 @@ package mage.sets.betrayersofkamigawa; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.CounterTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -93,9 +93,13 @@ class JettingGlasskiteAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.TARGETED && event.getTargetId().equals(this.getSourceId()) && game.getTurnNum() > turnUsed) { + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TARGETED; + } + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getTargetId().equals(this.getSourceId()) && game.getTurnNum() > turnUsed) { this.getTargets().clear(); TargetStackObject target = new TargetStackObject(); target.add(event.getSourceId(), game); diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/KamiOfTheHonoredDead.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/KamiOfTheHonoredDead.java index 21a31b702d..921e4ddb13 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/KamiOfTheHonoredDead.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/KamiOfTheHonoredDead.java @@ -28,10 +28,6 @@ package mage.sets.betrayersofkamigawa; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -39,9 +35,13 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.SoulshiftAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; /** @@ -92,11 +92,16 @@ class KamiOfTheHonoredDeadTriggeredAbility extends TriggeredAbilityImpl { return new KamiOfTheHonoredDeadTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId)) { - this.getEffects().get(0).setValue("damageAmount", event.getAmount()); - return true; + if (event.getTargetId().equals(this.sourceId)) { + this.getEffects().get(0).setValue("damageAmount", event.getAmount()); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/KiraGreatGlassSpinner.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/KiraGreatGlassSpinner.java index 4fb87fe03d..abdfe0da0f 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/KiraGreatGlassSpinner.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/KiraGreatGlassSpinner.java @@ -30,10 +30,6 @@ package mage.sets.betrayersofkamigawa; import java.util.HashMap; import java.util.Map; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; @@ -41,6 +37,10 @@ import mage.abilities.effects.common.CounterTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; @@ -102,20 +102,25 @@ class KiraGreatGlassSpinnerAbility extends TriggeredAbilityImpl { return new KiraGreatGlassSpinnerAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TARGETED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.TARGETED && event.getTargetId().equals(this.getSourceId())) { + if (event.getTargetId().equals(this.getSourceId())) { Integer turn = turnUsed.get(event.getTargetId()); - if (turn == null || turn.intValue() < game.getTurnNum()) { + if (turn == null || turn < game.getTurnNum()) { this.getTargets().clear(); TargetStackObject target = new TargetStackObject(); target.add(event.getSourceId(), game); this.addTarget(target); if (turnUsed.containsKey(event.getTargetId())) { turnUsed.remove(event.getTargetId()); - turnUsed.put(event.getTargetId(),new Integer(game.getTurnNum())); + turnUsed.put(event.getTargetId(), game.getTurnNum()); } else { - turnUsed.put(event.getTargetId(), new Integer(game.getTurnNum())); + turnUsed.put(event.getTargetId(), game.getTurnNum()); } return true; diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/MarkOfSakiko.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/MarkOfSakiko.java index 9ba3ec0dca..98dbfb2c5b 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/MarkOfSakiko.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/MarkOfSakiko.java @@ -44,8 +44,9 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; -import mage.game.events.DamagedPlayerEvent; +import mage.game.events.DamagedEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; import mage.target.targetpointer.FixedTarget; @@ -101,18 +102,21 @@ class MarkOfSakikoTriggeredAbility extends TriggeredAbilityImpl { return new MarkOfSakikoTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { - if (((DamagedPlayerEvent) event).isCombatDamage()) { - if (event.getSourceId().equals(getSourceId())) { - this.getEffects().clear(); - Effect effect = new AddManaToManaPoolTargetControllerEffect(new Mana(0,event.getAmount(),0,0,0,0,0), "that player", true); - effect.setTargetPointer(new FixedTarget(getControllerId())); - effect.setText("add that much {G} to your mana pool. Until end of turn, this mana doesn't empty from your mana pool as steps and phases end"); - this.addEffect(effect); - return true; - } + if (((DamagedEvent) event).isCombatDamage()) { + if (event.getSourceId().equals(getSourceId())) { + this.getEffects().clear(); + Effect effect = new AddManaToManaPoolTargetControllerEffect(new Mana(0,event.getAmount(),0,0,0,0,0), "that player", true); + effect.setTargetPointer(new FixedTarget(getControllerId())); + effect.setText("add that much {G} to your mana pool. Until end of turn, this mana doesn't empty from your mana pool as steps and phases end"); + this.addEffect(effect); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/MistbladeShinobi.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/MistbladeShinobi.java index 27ae8a6252..c791bf1df2 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/MistbladeShinobi.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/MistbladeShinobi.java @@ -28,20 +28,21 @@ package mage.sets.betrayersofkamigawa; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.keyword.NinjutsuAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.common.TargetCreaturePermanent; @@ -92,10 +93,14 @@ class MistbladeShinobiTriggeredAbility extends TriggeredAbilityImpl { return new MistbladeShinobiTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent - && ((DamagedPlayerEvent) event).isCombatDamage() + if (((DamagedPlayerEvent) event).isCombatDamage() && event.getSourceId().equals(sourceId)) { Player opponent = game.getPlayer(event.getPlayerId()); if (opponent != null) { diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheNezumi.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheNezumi.java index 1299882328..4ad31655ef 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheNezumi.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheNezumi.java @@ -28,9 +28,6 @@ package mage.sets.betrayersofkamigawa; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; @@ -38,6 +35,9 @@ import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.keyword.OfferingAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -87,17 +87,20 @@ class PatronOfTheNezumiTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getFromZone() == Zone.BATTLEFIELD - && zEvent.getToZone() == Zone.GRAVEYARD) { - Card card = game.getCard(zEvent.getTargetId()); - if (card != null && game.getOpponents(controllerId).contains(card.getOwnerId())) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(zEvent.getPlayerId())); - return true; - } + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone() == Zone.BATTLEFIELD + && zEvent.getToZone() == Zone.GRAVEYARD) { + Card card = game.getCard(zEvent.getTargetId()); + if (card != null && game.getOpponents(controllerId).contains(card.getOwnerId())) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(zEvent.getPlayerId())); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/RoninWarclub.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/RoninWarclub.java index 76bacd56dc..fedf501ce0 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/RoninWarclub.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/RoninWarclub.java @@ -28,10 +28,6 @@ package mage.sets.betrayersofkamigawa; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; @@ -40,8 +36,13 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continuous.BoostEquippedEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.Target; import mage.target.common.TargetCreaturePermanent; @@ -88,25 +89,28 @@ public class RoninWarclub extends CardImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent.getCardType().contains(CardType.CREATURE) - && (permanent.getControllerId().equals(this.controllerId))) { + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } - if (!this.getTargets().isEmpty()) { - // remove previous target - if (this.getTargets().get(0).getTargets().size() > 0) { - this.getTargets().clear(); - this.addTarget(new TargetCreaturePermanent()); - } - Target target = this.getTargets().get(0); - if (target instanceof TargetCreaturePermanent) { - target.add(event.getTargetId(), game); - } + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent.getCardType().contains(CardType.CREATURE) + && (permanent.getControllerId().equals(this.controllerId))) { + + if (!this.getTargets().isEmpty()) { + // remove previous target + if (this.getTargets().get(0).getTargets().size() > 0) { + this.getTargets().clear(); + this.addTarget(new TargetCreaturePermanent()); + } + Target target = this.getTargets().get(0); + if (target instanceof TargetCreaturePermanent) { + target.add(event.getTargetId(), game); } - return true; } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/SakikoMotherOfSummer.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/SakikoMotherOfSummer.java index 11375e1b5b..fe8a3787c2 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/SakikoMotherOfSummer.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/SakikoMotherOfSummer.java @@ -33,15 +33,14 @@ import mage.Mana; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.AddManaToManaPoolTargetControllerEffect; -import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; -import mage.counters.CounterType; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -91,19 +90,22 @@ class SakikoMotherOfSummerTriggeredAbility extends TriggeredAbilityImpl { return new SakikoMotherOfSummerTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { - if (((DamagedPlayerEvent) event).isCombatDamage()) { - Permanent creature = game.getPermanent(event.getSourceId()); - if (creature != null && creature.getControllerId().equals(controllerId)) { - this.getEffects().clear(); - Effect effect = new AddManaToManaPoolTargetControllerEffect(new Mana(0,event.getAmount(),0,0,0,0,0), "that player", true); - effect.setTargetPointer(new FixedTarget(creature.getControllerId())); - effect.setText("add that much {G} to your mana pool. Until end of turn, this mana doesn't empty from your mana pool as steps and phases end"); - this.addEffect(effect); - return true; - } + if (((DamagedPlayerEvent) event).isCombatDamage()) { + Permanent creature = game.getPermanent(event.getSourceId()); + if (creature != null && creature.getControllerId().equals(controllerId)) { + this.getEffects().clear(); + Effect effect = new AddManaToManaPoolTargetControllerEffect(new Mana(0,event.getAmount(),0,0,0,0,0), "that player", true); + effect.setTargetPointer(new FixedTarget(creature.getControllerId())); + effect.setText("add that much {G} to your mana pool. Until end of turn, this mana doesn't empty from your mana pool as steps and phases end"); + this.addEffect(effect); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShimmeringGlasskite.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShimmeringGlasskite.java index 4f22ae29da..9d43915b66 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShimmeringGlasskite.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShimmeringGlasskite.java @@ -28,14 +28,14 @@ package mage.sets.betrayersofkamigawa; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.CounterTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -93,9 +93,13 @@ class ShimmeringGlasskiteAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.TARGETED && event.getTargetId().equals(this.getSourceId()) && game.getTurnNum() > turnUsed) { + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TARGETED; + } + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getTargetId().equals(this.getSourceId()) && game.getTurnNum() > turnUsed) { this.getTargets().clear(); TargetStackObject target = new TargetStackObject(); target.add(event.getSourceId(), game); diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShireiShizosCaretaker.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShireiShizosCaretaker.java index 0cec774401..58f970e9d4 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShireiShizosCaretaker.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/ShireiShizosCaretaker.java @@ -92,25 +92,28 @@ class ShireiShizosCaretakerTriggeredAbility extends TriggeredAbilityImpl { public ShireiShizosCaretakerTriggeredAbility copy() { return new ShireiShizosCaretakerTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - Permanent LKIpermanent = game.getPermanentOrLKIBattlefield(zEvent.getTargetId()); - Card card = game.getCard(zEvent.getTargetId()); + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + Permanent LKIpermanent = game.getPermanentOrLKIBattlefield(zEvent.getTargetId()); + Card card = game.getCard(zEvent.getTargetId()); - if (card != null && LKIpermanent != null && - card.getOwnerId().equals(this.controllerId) && - zEvent.getToZone() == Zone.GRAVEYARD && - zEvent.getFromZone() == Zone.BATTLEFIELD && - card.getCardType().contains(CardType.CREATURE) && - LKIpermanent.getPower().getValue() <= 1) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(zEvent.getTargetId())); - } - return true; + if (card != null && LKIpermanent != null && + card.getOwnerId().equals(this.controllerId) && + zEvent.getToZone() == Zone.GRAVEYARD && + zEvent.getFromZone() == Zone.BATTLEFIELD && + card.getCardType().contains(CardType.CREATURE) && + LKIpermanent.getPower().getValue() <= 1) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(zEvent.getTargetId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/Skullsnatcher.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/Skullsnatcher.java index 9cec6dbae4..7031cef644 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/Skullsnatcher.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/Skullsnatcher.java @@ -28,9 +28,6 @@ package mage.sets.betrayersofkamigawa; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.ManaCostsImpl; @@ -38,6 +35,8 @@ import mage.abilities.effects.Effect; import mage.abilities.effects.common.ExileTargetEffect; import mage.abilities.keyword.NinjutsuAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.common.FilterControlledCreaturePermanent; @@ -46,6 +45,7 @@ import mage.filter.predicate.permanent.UnblockedPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCardInOpponentsGraveyard; /** @@ -103,10 +103,14 @@ class SkullsnatcherTriggeredAbility extends TriggeredAbilityImpl { return new SkullsnatcherTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent - && ((DamagedPlayerEvent) event).isCombatDamage() + if (((DamagedPlayerEvent) event).isCombatDamage() && event.getSourceId().equals(sourceId)) { FilterCard filter = new FilterCard("up to two target cards from that player's graveyard"); diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/ThroatSlitter.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/ThroatSlitter.java index 96855f251f..73ae590b27 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/ThroatSlitter.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/ThroatSlitter.java @@ -28,9 +28,6 @@ package mage.sets.betrayersofkamigawa; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.ObjectColor; import mage.abilities.TriggeredAbilityImpl; @@ -38,6 +35,9 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.NinjutsuAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorPredicate; @@ -45,6 +45,7 @@ import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.TargetPermanent; /** @@ -94,10 +95,14 @@ class ThroatSlitterTriggeredAbility extends TriggeredAbilityImpl { return new ThroatSlitterTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent - && ((DamagedPlayerEvent) event).isCombatDamage() + if (((DamagedPlayerEvent) event).isCombatDamage() && event.getSourceId().equals(sourceId)) { FilterCreaturePermanent filter = new FilterCreaturePermanent("nonblack creature that player controls"); diff --git a/Mage.Sets/src/mage/sets/bornofthegods/PerplexingChimera.java b/Mage.Sets/src/mage/sets/bornofthegods/PerplexingChimera.java index 625795542a..a249d46d93 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/PerplexingChimera.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/PerplexingChimera.java @@ -45,6 +45,7 @@ import mage.constants.SubLayer; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.stack.Spell; import mage.players.Player; @@ -130,9 +131,14 @@ class PerplexingChimeraTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST && game.getOpponents(controllerId).contains(event.getPlayerId())) { + if (game.getOpponents(controllerId).contains(event.getPlayerId())) { for (Effect effect: this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getTargetId())); } diff --git a/Mage.Sets/src/mage/sets/bornofthegods/SearingBlood.java b/Mage.Sets/src/mage/sets/bornofthegods/SearingBlood.java index 7b5e332638..c7e59facd0 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/SearingBlood.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/SearingBlood.java @@ -115,9 +115,14 @@ class SearingBloodDelayedTriggeredAbility extends DelayedTriggeredAbility { this.target = ability.target; } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(target)) { + if (event.getTargetId().equals(target)) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { return true; diff --git a/Mage.Sets/src/mage/sets/bornofthegods/SpitefulReturned.java b/Mage.Sets/src/mage/sets/bornofthegods/SpitefulReturned.java index bb39ac5c1e..3f132ca507 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/SpitefulReturned.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/SpitefulReturned.java @@ -42,6 +42,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -94,26 +95,28 @@ class SpitefulReturnedTriggeredAbility extends TriggeredAbilityImpl { return new SpitefulReturnedTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) { - Permanent sourcePermanent = game.getPermanent(this.getSourceId()); - if (sourcePermanent != null) { - if (sourcePermanent.getCardType().contains(CardType.CREATURE)) { - if (event.getSourceId() == this.getSourceId()) { - UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game); - this.getEffects().get(0).setTargetPointer(new FixedTarget(defender)); - return true; - } - } else { - if (sourcePermanent.getAttachedTo() != null && sourcePermanent.getAttachedTo().equals(event.getSourceId())) { - UUID defender = game.getCombat().getDefendingPlayerId(sourcePermanent.getAttachedTo(), game); - this.getEffects().get(0).setTargetPointer(new FixedTarget(defender)); - return true; - } + Permanent sourcePermanent = game.getPermanent(this.getSourceId()); + if (sourcePermanent != null) { + if (sourcePermanent.getCardType().contains(CardType.CREATURE)) { + if (event.getSourceId() == this.getSourceId()) { + UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game); + this.getEffects().get(0).setTargetPointer(new FixedTarget(defender)); + return true; + } + } else { + if (sourcePermanent.getAttachedTo() != null && sourcePermanent.getAttachedTo().equals(event.getSourceId())) { + UUID defender = game.getCombat().getDefendingPlayerId(sourcePermanent.getAttachedTo(), game); + this.getEffects().get(0).setTargetPointer(new FixedTarget(defender)); + return true; } } - } return false; } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/AkkiLavarunner.java b/Mage.Sets/src/mage/sets/championsofkamigawa/AkkiLavarunner.java index f0edd96bc5..c4afd226be 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/AkkiLavarunner.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/AkkiLavarunner.java @@ -1,5 +1,6 @@ package mage.sets.championsofkamigawa; +import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; @@ -11,16 +12,19 @@ import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.ProtectionAbility; import mage.cards.Card; import mage.cards.CardImpl; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.token.Token; -import java.util.UUID; - /** * @author Loki */ @@ -68,15 +72,15 @@ class AkkiLavarunnerAbility extends TriggeredAbilityImpl { return new AkkiLavarunnerAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; - if (damageEvent.isCombatDamage() && this.sourceId.equals(event.getSourceId())) { - return true; - } - } - return false; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + return damageEvent.isCombatDamage() && this.sourceId.equals(event.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/AkkiUnderminer.java b/Mage.Sets/src/mage/sets/championsofkamigawa/AkkiUnderminer.java index 43b28458e8..d27a1170aa 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/AkkiUnderminer.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/AkkiUnderminer.java @@ -29,19 +29,19 @@ package mage.sets.championsofkamigawa; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.SacrificeEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -88,16 +88,19 @@ class AkkiUnderminerAbility extends TriggeredAbilityImpl { return new AkkiUnderminerAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - return true; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/GlimpseOfNature.java b/Mage.Sets/src/mage/sets/championsofkamigawa/GlimpseOfNature.java index 932d398265..14e5a67bdf 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/GlimpseOfNature.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/GlimpseOfNature.java @@ -28,18 +28,18 @@ package mage.sets.championsofkamigawa; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.filter.FilterSpell; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; public class GlimpseOfNature extends CardImpl { @@ -79,9 +79,14 @@ class GlimpseOfNatureTriggeredAbility extends DelayedTriggeredAbility { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(this.getControllerId())) { + if (event.getPlayerId().equals(this.getControllerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && filter.match(spell, game)) { return true; diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/GodoBanditWarlord.java b/Mage.Sets/src/mage/sets/championsofkamigawa/GodoBanditWarlord.java index 3215be1d38..6e08a587c1 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/GodoBanditWarlord.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/GodoBanditWarlord.java @@ -109,16 +109,21 @@ class GodoBanditWarlordAttacksTriggeredAbility extends TriggeredAbilityImpl { @Override public void reset(Game game) { - game.getState().setValue(CardUtil.getCardZoneString("amountAttacks", this.getSourceId(), game), new Integer(0)); + game.getState().setValue(CardUtil.getCardZoneString("amountAttacks", this.getSourceId(), game), 0); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId()) ) { + if (event.getSourceId().equals(this.getSourceId()) ) { Integer amountAttacks = (Integer) game.getState().getValue(CardUtil.getCardZoneString("amountAttacks", this.getSourceId(), game)); - if (amountAttacks == null || amountAttacks.intValue() < 1) { + if (amountAttacks == null || amountAttacks < 1) { if (amountAttacks == null) { - amountAttacks = new Integer(1); + amountAttacks = 1; } else { ++amountAttacks; } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/HorobiDeathsWail.java b/Mage.Sets/src/mage/sets/championsofkamigawa/HorobiDeathsWail.java index d3bb27b64e..a254027b6a 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/HorobiDeathsWail.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/HorobiDeathsWail.java @@ -97,14 +97,17 @@ class HorobiDeathsWailAbility extends TriggeredAbilityImpl { return new HorobiDeathsWailAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TARGETED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.TARGETED) { - Permanent creature = game.getPermanent(event.getTargetId()); - if (creature != null && creature.getCardType().contains(CardType.CREATURE)) { - getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId())); - return true; - } + Permanent creature = game.getPermanent(event.getTargetId()); + if (creature != null && creature.getCardType().contains(CardType.CREATURE)) { + getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/KusariGama.java b/Mage.Sets/src/mage/sets/championsofkamigawa/KusariGama.java index 0ec6c8e799..2745e9eb4f 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/KusariGama.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/KusariGama.java @@ -48,8 +48,8 @@ import mage.constants.Zone; import mage.filter.common.FilterBlockingCreature; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; -import mage.game.events.DamagedEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -102,16 +102,19 @@ class KusariGamaAbility extends TriggeredAbilityImpl { return new KusariGamaAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedEvent) { - Permanent sourcePermanet = game.getPermanent(event.getSourceId()); - Permanent targetPermanet = game.getPermanent(event.getTargetId()); - if (sourcePermanet != null && targetPermanet != null && sourcePermanet.getAttachments().contains(this.getSourceId()) && filter.match(targetPermanet, game)) { - this.getEffects().get(0).setValue("damageAmount", event.getAmount()); - this.getEffects().get(0).setValue("damagedCreatureId", targetPermanet.getId()); - return true; - } + Permanent sourcePermanet = game.getPermanent(event.getSourceId()); + Permanent targetPermanet = game.getPermanent(event.getTargetId()); + if (sourcePermanet != null && targetPermanet != null && sourcePermanet.getAttachments().contains(this.getSourceId()) && filter.match(targetPermanet, game)) { + this.getEffects().get(0).setValue("damageAmount", event.getAmount()); + this.getEffects().get(0).setValue("damagedCreatureId", targetPermanet.getId()); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/NaturesWill.java b/Mage.Sets/src/mage/sets/championsofkamigawa/NaturesWill.java index f3f5312183..6c5ed8f79d 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/NaturesWill.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/NaturesWill.java @@ -44,6 +44,7 @@ import mage.filter.common.FilterLandPermanent; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -92,9 +93,14 @@ class NaturesWillTriggeredAbility extends TriggeredAbilityImpl { return new NaturesWillTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER || event.getType() == EventType.COMBAT_DAMAGE_STEP_POST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { + if (event.getType() == EventType.DAMAGED_PLAYER) { DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; Permanent p = game.getPermanent(event.getSourceId()); if (damageEvent.isCombatDamage() && p != null && p.getControllerId().equals(this.getControllerId())) { @@ -102,7 +108,7 @@ class NaturesWillTriggeredAbility extends TriggeredAbilityImpl { damagedPlayers.add(event.getPlayerId()); } } - if (event.getType().equals(GameEvent.EventType.COMBAT_DAMAGE_STEP_POST)) { + if (event.getType().equals(EventType.COMBAT_DAMAGE_STEP_POST)) { if (madeDamge) { Set damagedPlayersCopy = new HashSet(); damagedPlayersCopy.addAll(damagedPlayers); diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/RaggedVeins.java b/Mage.Sets/src/mage/sets/championsofkamigawa/RaggedVeins.java index a95b255300..551f3c750d 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/RaggedVeins.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/RaggedVeins.java @@ -29,11 +29,6 @@ package mage.sets.championsofkamigawa; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; @@ -41,8 +36,13 @@ import mage.abilities.effects.common.AttachEffect; import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.FlashAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; @@ -99,16 +99,19 @@ class RaggedVeinsTriggeredAbility extends TriggeredAbilityImpl { return new RaggedVeinsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) { - Permanent enchantment = game.getPermanent(sourceId); - UUID targetId = event.getTargetId(); - if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) { - this.getEffects().get(0).setValue("damageAmount", event.getAmount()); - this.getEffects().get(0).setTargetPointer(new FixedTarget(targetId)); - return true; - } + Permanent enchantment = game.getPermanent(sourceId); + UUID targetId = event.getTargetId(); + if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) { + this.getEffects().get(0).setValue("damageAmount", event.getAmount()); + this.getEffects().get(0).setTargetPointer(new FixedTarget(targetId)); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/SeshiroTheAnointed.java b/Mage.Sets/src/mage/sets/championsofkamigawa/SeshiroTheAnointed.java index 3ed8eadffa..ea8a4e1228 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/SeshiroTheAnointed.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/SeshiroTheAnointed.java @@ -29,22 +29,22 @@ package mage.sets.championsofkamigawa; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -97,14 +97,17 @@ class SeshiroTheAnointedAbility extends TriggeredAbilityImpl { return new SeshiroTheAnointedAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - Permanent p = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && p != null && p.hasSubtype("Snake") && p.getControllerId().equals(controllerId)) { - return true; - } + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + Permanent p = game.getPermanent(event.getSourceId()); + if (damageEvent.isCombatDamage() && p != null && p.hasSubtype("Snake") && p.getControllerId().equals(controllerId)) { + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/SosukeSonOfSeshiro.java b/Mage.Sets/src/mage/sets/championsofkamigawa/SosukeSonOfSeshiro.java index 6a73491ac9..29c128af84 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/SosukeSonOfSeshiro.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/SosukeSonOfSeshiro.java @@ -28,8 +28,6 @@ package mage.sets.championsofkamigawa; import java.util.UUID; - -import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -39,11 +37,17 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.DamagedCreatureEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -100,17 +104,20 @@ class SosukeSonOfSeshiroTriggeredAbility extends TriggeredAbilityImpl { return new SosukeSonOfSeshiroTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedCreatureEvent) { - if (((DamagedCreatureEvent) event).isCombatDamage()) { - Permanent sourceCreature = game.getPermanent(event.getSourceId()); - Permanent targetCreature = game.getPermanent(event.getTargetId()); - if (sourceCreature != null && sourceCreature.getControllerId().equals(this.getControllerId()) - && targetCreature != null && sourceCreature.hasSubtype("Warrior")) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(targetCreature.getId())); - return true; - } + if (((DamagedCreatureEvent) event).isCombatDamage()) { + Permanent sourceCreature = game.getPermanent(event.getSourceId()); + Permanent targetCreature = game.getPermanent(event.getTargetId()); + if (sourceCreature != null && sourceCreature.getControllerId().equals(this.getControllerId()) + && targetCreature != null && sourceCreature.hasSubtype("Warrior")) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(targetCreature.getId())); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/TatsumasaTheDragonsFang.java b/Mage.Sets/src/mage/sets/championsofkamigawa/TatsumasaTheDragonsFang.java index 419f09538d..a9e7ff37db 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/TatsumasaTheDragonsFang.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/TatsumasaTheDragonsFang.java @@ -49,6 +49,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.token.Token; import mage.target.targetpointer.FixedTarget; @@ -137,9 +138,14 @@ class TatsumaTheDragonsFangTriggeredAbility extends DelayedTriggeredAbility { return new TatsumaTheDragonsFangTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { + if (((ZoneChangeEvent) event).isDiesEvent()) { if (fixedTarget.getFirst(game, this).equals(event.getTargetId())) { return true; } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/TideOfWar.java b/Mage.Sets/src/mage/sets/championsofkamigawa/TideOfWar.java index f729fef98f..60799576bd 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/TideOfWar.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/TideOfWar.java @@ -42,6 +42,7 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.combat.CombatGroup; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; @@ -80,13 +81,16 @@ class BlocksTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_BLOCKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DECLARED_BLOCKERS) { - for (CombatGroup combatGroup: game.getCombat().getGroups()) { - if (!combatGroup.getBlockers().isEmpty()) { - return true; - } + for (CombatGroup combatGroup: game.getCombat().getGroups()) { + if (!combatGroup.getBlockers().isEmpty()) { + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/ZoZuThePunisher.java b/Mage.Sets/src/mage/sets/championsofkamigawa/ZoZuThePunisher.java index 723286834d..d34bb5e8fa 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/ZoZuThePunisher.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/ZoZuThePunisher.java @@ -28,19 +28,19 @@ package mage.sets.championsofkamigawa; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.SupertypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -95,18 +95,21 @@ class ZoZuThePunisherAbility extends TriggeredAbilityImpl { return new ZoZuThePunisherAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent != null && permanent.getCardType().contains(CardType.LAND)) { - Player player = game.getPlayer(permanent.getControllerId()); - if (player != null) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(player.getId())); - } - return true; + if (permanent != null && permanent.getCardType().contains(CardType.LAND)) { + Player player = game.getPlayer(permanent.getControllerId()); + if (player != null) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(player.getId())); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/coldsnap/AdarkarValkyrie.java b/Mage.Sets/src/mage/sets/coldsnap/AdarkarValkyrie.java index 13e284417b..cf4356084d 100644 --- a/Mage.Sets/src/mage/sets/coldsnap/AdarkarValkyrie.java +++ b/Mage.Sets/src/mage/sets/coldsnap/AdarkarValkyrie.java @@ -28,11 +28,6 @@ package mage.sets.coldsnap; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; @@ -43,10 +38,16 @@ import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEf import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.target.Target; import mage.target.common.TargetCreaturePermanent; @@ -141,9 +142,14 @@ class AdarkarValkyrieDelayedTriggeredAbility extends DelayedTriggeredAbility { return new AdarkarValkyrieDelayedTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { + if (((ZoneChangeEvent) event).isDiesEvent()) { if (fixedTarget.getFirst(game, this).equals(event.getTargetId())) { return true; } diff --git a/Mage.Sets/src/mage/sets/coldsnap/DarienKingOfKjeldor.java b/Mage.Sets/src/mage/sets/coldsnap/DarienKingOfKjeldor.java index 560a5f0f70..d1d2b43d7b 100644 --- a/Mage.Sets/src/mage/sets/coldsnap/DarienKingOfKjeldor.java +++ b/Mage.Sets/src/mage/sets/coldsnap/DarienKingOfKjeldor.java @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.token.SoldierToken; import mage.players.Player; @@ -87,12 +88,17 @@ class DarienKingOfKjeldorTriggeredAbility extends TriggeredAbilityImpl { return new DarienKingOfKjeldorTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if ((event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getTargetId().equals(this.getControllerId()))) { - this.getEffects().get(0).setValue("damageAmount", event.getAmount()); - return true; - } + if ((event.getTargetId().equals(this.getControllerId()))) { + this.getEffects().get(0).setValue("damageAmount", event.getAmount()); + return true; + } return false; } diff --git a/Mage.Sets/src/mage/sets/coldsnap/FuryOfTheHorde.java b/Mage.Sets/src/mage/sets/coldsnap/FuryOfTheHorde.java index 68c678de3a..d672dfc494 100644 --- a/Mage.Sets/src/mage/sets/coldsnap/FuryOfTheHorde.java +++ b/Mage.Sets/src/mage/sets/coldsnap/FuryOfTheHorde.java @@ -45,6 +45,7 @@ import mage.filter.FilterCard; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.turn.TurnMod; import mage.target.common.TargetCardInHand; @@ -180,6 +181,11 @@ class DelayedAddMainPhaseAbility extends DelayedTriggeredAbility { return new DelayedAddMainPhaseAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.PHASE_CHANGED || event.getType() == EventType.COMBAT_PHASE_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.PHASE_CHANGED && this.connectedTurnMod.equals(event.getSourceId())) { diff --git a/Mage.Sets/src/mage/sets/commander/EdricSpymasterOfTrest.java b/Mage.Sets/src/mage/sets/commander/EdricSpymasterOfTrest.java index 2803c0e36e..1da8c8e947 100644 --- a/Mage.Sets/src/mage/sets/commander/EdricSpymasterOfTrest.java +++ b/Mage.Sets/src/mage/sets/commander/EdricSpymasterOfTrest.java @@ -87,10 +87,13 @@ class EdricSpymasterOfTrestTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } - if (event.getType().equals(EventType.DAMAGED_PLAYER) && - ((DamagedPlayerEvent) event).isCombatDamage() && + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (((DamagedPlayerEvent) event).isCombatDamage() && game.getOpponents(this.controllerId).contains(((DamagedPlayerEvent) event).getPlayerId())) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(game.getPermanent(event.getSourceId()).getControllerId())); diff --git a/Mage.Sets/src/mage/sets/commander/KaaliaOfTheVast.java b/Mage.Sets/src/mage/sets/commander/KaaliaOfTheVast.java index 1fda32b5b5..562935d4c6 100644 --- a/Mage.Sets/src/mage/sets/commander/KaaliaOfTheVast.java +++ b/Mage.Sets/src/mage/sets/commander/KaaliaOfTheVast.java @@ -30,15 +30,15 @@ package mage.sets.commander; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.SubtypePredicate; @@ -94,9 +94,14 @@ class KaaliaOfTheVastAttacksAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { + if (event.getSourceId().equals(this.getSourceId())) { Player opponent = game.getPlayer(event.getTargetId()); if (opponent != null) { return true; diff --git a/Mage.Sets/src/mage/sets/commander/SewerNemesis.java b/Mage.Sets/src/mage/sets/commander/SewerNemesis.java index ee6da4ab79..fa7df34d3f 100644 --- a/Mage.Sets/src/mage/sets/commander/SewerNemesis.java +++ b/Mage.Sets/src/mage/sets/commander/SewerNemesis.java @@ -27,6 +27,7 @@ */ package mage.sets.commander; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -38,16 +39,19 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveTargetEffect; import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect; import mage.cards.CardImpl; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPlayer; import mage.target.targetpointer.FixedTarget; -import java.util.UUID; - /** * * @author LevelX2 @@ -155,15 +159,17 @@ class SewerNemesisTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - // chosen player casts a spell - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - UUID playerId = (UUID) game.getState().getValue(getSourceId() + "_player"); - if (playerId.equals(event.getPlayerId())) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(playerId)); - return true; - } + UUID playerId = (UUID) game.getState().getValue(getSourceId() + "_player"); + if (playerId.equals(event.getPlayerId())) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(playerId)); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/commander2013/CurseOfChaos.java b/Mage.Sets/src/mage/sets/commander2013/CurseOfChaos.java index aba960d1bc..cb4931a6e3 100644 --- a/Mage.Sets/src/mage/sets/commander2013/CurseOfChaos.java +++ b/Mage.Sets/src/mage/sets/commander2013/CurseOfChaos.java @@ -90,18 +90,21 @@ class CurseOfChaosTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(EventType.DECLARED_ATTACKERS)) { - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null - && enchantment.getAttachedTo() != null - && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { - for (Effect effect: this.getEffects()) { - effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); - } - return true; + Permanent enchantment = game.getPermanent(this.getSourceId()); + if (enchantment != null + && enchantment.getAttachedTo() != null + && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/commander2013/CurseOfPredation.java b/Mage.Sets/src/mage/sets/commander2013/CurseOfPredation.java index 755913c61b..12aa2df4ba 100644 --- a/Mage.Sets/src/mage/sets/commander2013/CurseOfPredation.java +++ b/Mage.Sets/src/mage/sets/commander2013/CurseOfPredation.java @@ -94,26 +94,29 @@ class CurseOfPredationTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(EventType.ATTACKER_DECLARED)) { - Player defender = game.getPlayer(event.getTargetId()); - if (defender == null) { - Permanent planeswalker = game.getPermanent(event.getTargetId()); - if (planeswalker != null) { - defender = game.getPlayer(planeswalker.getControllerId()); - } + Player defender = game.getPlayer(event.getTargetId()); + if (defender == null) { + Permanent planeswalker = game.getPermanent(event.getTargetId()); + if (planeswalker != null) { + defender = game.getPlayer(planeswalker.getControllerId()); } - if (defender != null) { - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null - && enchantment.getAttachedTo() != null - && enchantment.getAttachedTo().equals(defender.getId())) { - for (Effect effect: this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getSourceId())); - } - return true; + } + if (defender != null) { + Permanent enchantment = game.getPermanent(this.getSourceId()); + if (enchantment != null + && enchantment.getAttachedTo() != null + && enchantment.getAttachedTo().equals(defender.getId())) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getSourceId())); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/commander2013/CurseOfShallowGraves.java b/Mage.Sets/src/mage/sets/commander2013/CurseOfShallowGraves.java index c466a4aba1..fa2e34e982 100644 --- a/Mage.Sets/src/mage/sets/commander2013/CurseOfShallowGraves.java +++ b/Mage.Sets/src/mage/sets/commander2013/CurseOfShallowGraves.java @@ -44,7 +44,6 @@ import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.permanent.token.ZombieToken; -import mage.players.Player; import mage.target.TargetPlayer; import mage.target.targetpointer.FixedTarget; @@ -95,18 +94,21 @@ class CurseOfShallowTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(EventType.DECLARED_ATTACKERS)) { - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null - && enchantment.getAttachedTo() != null - && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { - for (Effect effect: this.getEffects()) { - effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); - } - return true; + Permanent enchantment = game.getPermanent(this.getSourceId()); + if (enchantment != null + && enchantment.getAttachedTo() != null + && game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/commander2013/CurseOfTheForsaken.java b/Mage.Sets/src/mage/sets/commander2013/CurseOfTheForsaken.java index 038f0b9a84..8011fafb75 100644 --- a/Mage.Sets/src/mage/sets/commander2013/CurseOfTheForsaken.java +++ b/Mage.Sets/src/mage/sets/commander2013/CurseOfTheForsaken.java @@ -93,26 +93,29 @@ class CurseOfTheForsakenTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(EventType.ATTACKER_DECLARED)) { - Player defender = game.getPlayer(event.getTargetId()); - if (defender == null) { - Permanent planeswalker = game.getPermanent(event.getTargetId()); - if (planeswalker != null) { - defender = game.getPlayer(planeswalker.getControllerId()); - } + Player defender = game.getPlayer(event.getTargetId()); + if (defender == null) { + Permanent planeswalker = game.getPermanent(event.getTargetId()); + if (planeswalker != null) { + defender = game.getPlayer(planeswalker.getControllerId()); } - if (defender != null) { - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null - && enchantment.getAttachedTo() != null - && enchantment.getAttachedTo().equals(defender.getId())) { - for (Effect effect: this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - return true; + } + if (defender != null) { + Permanent enchantment = game.getPermanent(this.getSourceId()); + if (enchantment != null + && enchantment.getAttachedTo() != null + && enchantment.getAttachedTo().equals(defender.getId())) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/commander2013/DereviEmpyrialTactician.java b/Mage.Sets/src/mage/sets/commander2013/DereviEmpyrialTactician.java index 5d0cf42452..125f9f8748 100644 --- a/Mage.Sets/src/mage/sets/commander2013/DereviEmpyrialTactician.java +++ b/Mage.Sets/src/mage/sets/commander2013/DereviEmpyrialTactician.java @@ -46,6 +46,7 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; @@ -97,6 +98,11 @@ class DereviEmpyrialTacticianTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD || event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD diff --git a/Mage.Sets/src/mage/sets/commander2013/GahijiHonoredOne.java b/Mage.Sets/src/mage/sets/commander2013/GahijiHonoredOne.java index 3efebe96d8..6207f2a8db 100644 --- a/Mage.Sets/src/mage/sets/commander2013/GahijiHonoredOne.java +++ b/Mage.Sets/src/mage/sets/commander2013/GahijiHonoredOne.java @@ -89,24 +89,27 @@ class GahijiHonoredOneTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(EventType.ATTACKER_DECLARED)) { - Player defender = game.getPlayer(event.getTargetId()); - if (defender == null) { - Permanent planeswalker = game.getPermanent(event.getTargetId()); - if (planeswalker != null) { - defender = game.getPlayer(planeswalker.getControllerId()); - } + Player defender = game.getPlayer(event.getTargetId()); + if (defender == null) { + Permanent planeswalker = game.getPermanent(event.getTargetId()); + if (planeswalker != null) { + defender = game.getPlayer(planeswalker.getControllerId()); } - if (defender != null) { - Set opponents = game.getOpponents(this.getControllerId()); - if (opponents != null && opponents.contains(defender.getId())) { - for (Effect effect: this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getSourceId())); - } - return true; + } + if (defender != null) { + Set opponents = game.getOpponents(this.getControllerId()); + if (opponents != null && opponents.contains(defender.getId())) { + for (Effect effect: this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getSourceId())); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/commander2013/Mirari.java b/Mage.Sets/src/mage/sets/commander2013/Mirari.java index 5d985d6293..a0ed6f66ee 100644 --- a/Mage.Sets/src/mage/sets/commander2013/Mirari.java +++ b/Mage.Sets/src/mage/sets/commander2013/Mirari.java @@ -41,6 +41,7 @@ import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.target.TargetSpell; @@ -95,9 +96,14 @@ class MirariTriggeredAbility extends TriggeredAbilityImpl { return new MirariTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(this.getControllerId())) { + if (event.getPlayerId().equals(this.getControllerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (isControlledInstantOrSorcery(spell)) { this.getTargets().get(0).clearChosen(); diff --git a/Mage.Sets/src/mage/sets/commander2013/PlagueBoiler.java b/Mage.Sets/src/mage/sets/commander2013/PlagueBoiler.java index 89fedf703a..4ea19f2722 100644 --- a/Mage.Sets/src/mage/sets/commander2013/PlagueBoiler.java +++ b/Mage.Sets/src/mage/sets/commander2013/PlagueBoiler.java @@ -126,9 +126,14 @@ class PlagueBoilerTriggeredAbility extends TriggeredAbilityImpl { return new PlagueBoilerTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.COUNTER_ADDED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(EventType.COUNTER_ADDED) && event.getTargetId().equals(this.getSourceId()) && event.getData().equals(CounterType.PLAGUE.getName())) { + if (event.getTargetId().equals(this.getSourceId()) && event.getData().equals(CounterType.PLAGUE.getName())) { Permanent sourcePermanent = game.getPermanent(this.getSourceId()); if (sourcePermanent != null && sourcePermanent.getCounters().getCount(CounterType.PLAGUE) >= 3) { return true; diff --git a/Mage.Sets/src/mage/sets/commander2013/Reincarnation.java b/Mage.Sets/src/mage/sets/commander2013/Reincarnation.java index 6ee57c9c0a..2afdb2d69b 100644 --- a/Mage.Sets/src/mage/sets/commander2013/Reincarnation.java +++ b/Mage.Sets/src/mage/sets/commander2013/Reincarnation.java @@ -117,9 +117,14 @@ class ReincarnationDelayedTriggeredAbility extends DelayedTriggeredAbility { this.target = ability.target; } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(target)) { + if (event.getTargetId().equals(target)) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { return true; diff --git a/Mage.Sets/src/mage/sets/commander2013/SunDroplet.java b/Mage.Sets/src/mage/sets/commander2013/SunDroplet.java index 379782a1a7..acc33c800a 100644 --- a/Mage.Sets/src/mage/sets/commander2013/SunDroplet.java +++ b/Mage.Sets/src/mage/sets/commander2013/SunDroplet.java @@ -48,6 +48,7 @@ import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -93,9 +94,14 @@ class SunDropletTriggeredAbility extends TriggeredAbilityImpl { return new SunDropletTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if ((event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getTargetId().equals(this.getControllerId()))) { + if (event.getTargetId().equals(this.getControllerId())) { this.getEffects().get(0).setValue("damageAmount", event.getAmount()); return true; } diff --git a/Mage.Sets/src/mage/sets/commander2013/WidespreadPanic.java b/Mage.Sets/src/mage/sets/commander2013/WidespreadPanic.java index 4b498f8db4..7dd5c75d80 100644 --- a/Mage.Sets/src/mage/sets/commander2013/WidespreadPanic.java +++ b/Mage.Sets/src/mage/sets/commander2013/WidespreadPanic.java @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.common.TargetCardInHand; import mage.target.targetpointer.FixedTarget; @@ -84,15 +85,17 @@ class WidespreadPanicTriggeredAbility extends TriggeredAbilityImpl { return new WidespreadPanicTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.LIBRARY_SHUFFLED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(GameEvent.EventType.LIBRARY_SHUFFLED)) { - for(Effect effect :this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - return true; + for (Effect effect :this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } - return false; + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/commander2014/DarettiScrapSavant.java b/Mage.Sets/src/mage/sets/commander2014/DarettiScrapSavant.java index 862aa72691..3436c1fb33 100644 --- a/Mage.Sets/src/mage/sets/commander2014/DarettiScrapSavant.java +++ b/Mage.Sets/src/mage/sets/commander2014/DarettiScrapSavant.java @@ -200,19 +200,22 @@ class DarettiScrapSavantTriggeredAbility extends TriggeredAbilityImpl { return new DarettiScrapSavantTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getToZone() == Zone.GRAVEYARD && - zEvent.getFromZone() == Zone.BATTLEFIELD && - zEvent.getTarget().getCardType().contains(CardType.ARTIFACT) && - zEvent.getTarget().getOwnerId().equals(this.controllerId)) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(zEvent.getTargetId())); - } - return true; + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getToZone() == Zone.GRAVEYARD && + zEvent.getFromZone() == Zone.BATTLEFIELD && + zEvent.getTarget().getCardType().contains(CardType.ARTIFACT) && + zEvent.getTarget().getOwnerId().equals(this.controllerId)) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(zEvent.getTargetId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/conflux/BloodTyrant.java b/Mage.Sets/src/mage/sets/conflux/BloodTyrant.java index 648fc5179a..1bb4dd28be 100644 --- a/Mage.Sets/src/mage/sets/conflux/BloodTyrant.java +++ b/Mage.Sets/src/mage/sets/conflux/BloodTyrant.java @@ -103,10 +103,15 @@ class PlayerLosesTheGameTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { + public boolean checkEventType(GameEvent event, Game game) { return event.getType() == EventType.LOSES; } + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return true; + } + @Override public String getRule() { return "Whenever a player loses the game, put five +1/+1 counters on {this}."; diff --git a/Mage.Sets/src/mage/sets/conflux/BloodhallOoze.java b/Mage.Sets/src/mage/sets/conflux/BloodhallOoze.java index 484a1864a5..3100b029dc 100644 --- a/Mage.Sets/src/mage/sets/conflux/BloodhallOoze.java +++ b/Mage.Sets/src/mage/sets/conflux/BloodhallOoze.java @@ -28,14 +28,15 @@ package mage.sets.conflux; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; +import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledPermanent; @@ -44,8 +45,6 @@ import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; -import java.util.UUID; - /** * * @author loki @@ -95,9 +94,14 @@ class BloodhallOozeTriggeredAbility1 extends TriggeredAbilityImpl { return new BloodhallOozeTriggeredAbility1(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { + if (event.getPlayerId().equals(this.controllerId)) { return true; } return false; @@ -135,9 +139,14 @@ class BloodhallOozeTriggeredAbility2 extends TriggeredAbilityImpl { return new BloodhallOozeTriggeredAbility2(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { + if (event.getPlayerId().equals(this.controllerId)) { return true; } return false; diff --git a/Mage.Sets/src/mage/sets/conflux/CorruptedRoots.java b/Mage.Sets/src/mage/sets/conflux/CorruptedRoots.java index 9dc77e7ee7..71acd4c156 100644 --- a/Mage.Sets/src/mage/sets/conflux/CorruptedRoots.java +++ b/Mage.Sets/src/mage/sets/conflux/CorruptedRoots.java @@ -44,6 +44,7 @@ import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; @@ -101,18 +102,21 @@ class CorruptedRootsTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TAPPED) { - Permanent enchantment = game.getPermanent(this.sourceId); - if (enchantment != null && enchantment.getAttachedTo().equals(event.getTargetId())) { - Permanent attached = game.getPermanent(enchantment.getAttachedTo()); - if (attached != null) { - for (Effect effect : getEffects()) { - effect.setTargetPointer(new FixedTarget(attached.getControllerId())); - } - return true; + Permanent enchantment = game.getPermanent(this.sourceId); + if (enchantment != null && enchantment.getAttachedTo().equals(event.getTargetId())) { + Permanent attached = game.getPermanent(enchantment.getAttachedTo()); + if (attached != null) { + for (Effect effect : getEffects()) { + effect.setTargetPointer(new FixedTarget(attached.getControllerId())); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/conflux/FontOfMythos.java b/Mage.Sets/src/mage/sets/conflux/FontOfMythos.java index 05b2b5d021..47667373b2 100644 --- a/Mage.Sets/src/mage/sets/conflux/FontOfMythos.java +++ b/Mage.Sets/src/mage/sets/conflux/FontOfMythos.java @@ -29,16 +29,15 @@ package mage.sets.conflux; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DrawCardTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; - import mage.target.TargetPlayer; /** @@ -79,15 +78,17 @@ class FontOfMythosAbility extends TriggeredAbilityImpl { return new FontOfMythosAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DRAW_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DRAW_STEP_PRE) { - this.getTargets().clear(); - this.addTarget(new TargetPlayer()); - getTargets().get(0).add(event.getPlayerId(),game); - return true; - } - return false; + this.getTargets().clear(); + this.addTarget(new TargetPlayer()); + getTargets().get(0).add(event.getPlayerId(),game); + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/conflux/KederektParasite.java b/Mage.Sets/src/mage/sets/conflux/KederektParasite.java index cf42f9ab4a..a55fb2f917 100644 --- a/Mage.Sets/src/mage/sets/conflux/KederektParasite.java +++ b/Mage.Sets/src/mage/sets/conflux/KederektParasite.java @@ -28,16 +28,16 @@ package mage.sets.conflux; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -84,9 +84,14 @@ class KederektParasiteTriggeredAbility extends TriggeredAbilityImpl { return new KederektParasiteTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DREW_CARD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DREW_CARD && game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) { + if (game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) { boolean youControlRedPermanent = false; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(this.getControllerId())) { if (permanent.getColor(game).isRed()) { diff --git a/Mage.Sets/src/mage/sets/conflux/ParasiticStrix.java b/Mage.Sets/src/mage/sets/conflux/ParasiticStrix.java index a0138fa907..a0113ee14b 100644 --- a/Mage.Sets/src/mage/sets/conflux/ParasiticStrix.java +++ b/Mage.Sets/src/mage/sets/conflux/ParasiticStrix.java @@ -92,12 +92,14 @@ class ParasiticStrixTriggeredAbility extends TriggeredAbilityImpl { return new ParasiticStrixTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(EventType.ENTERS_THE_BATTLEFIELD) && event.getTargetId().equals(this.getSourceId())) { - return true; - } - return false; + return event.getTargetId().equals(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/conflux/QuenchableFire.java b/Mage.Sets/src/mage/sets/conflux/QuenchableFire.java index 7338637ae0..881d4bbb18 100644 --- a/Mage.Sets/src/mage/sets/conflux/QuenchableFire.java +++ b/Mage.Sets/src/mage/sets/conflux/QuenchableFire.java @@ -30,9 +30,6 @@ package mage.sets.conflux; import java.util.UUID; import mage.MageObject; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.SpecialAction; @@ -43,10 +40,12 @@ import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.RemoveDelayedTriggeredAbilityEffect; import mage.abilities.effects.common.RemoveSpecialActionEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; - import mage.target.TargetPlayer; /** @@ -148,9 +147,14 @@ class QuenchableFireDelayedTriggeredAbility extends DelayedTriggeredAbility { return new QuenchableFireDelayedTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { + if (event.getPlayerId().equals(this.controllerId)) { for (SpecialAction action: game.getState().getSpecialActions()) { if (action.getId().equals(specialActionId)) { game.getState().getSpecialActions().remove(action); @@ -178,5 +182,4 @@ class QuenchableFireSpecialAction extends SpecialAction { public QuenchableFireSpecialAction copy() { return new QuenchableFireSpecialAction(this); } - } \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/conflux/SludgeStrider.java b/Mage.Sets/src/mage/sets/conflux/SludgeStrider.java index cfaa23940e..bb67a818b4 100644 --- a/Mage.Sets/src/mage/sets/conflux/SludgeStrider.java +++ b/Mage.Sets/src/mage/sets/conflux/SludgeStrider.java @@ -45,6 +45,7 @@ import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -98,6 +99,11 @@ class SludgeStriderTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD || event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { diff --git a/Mage.Sets/src/mage/sets/conspiracy/DackFayden.java b/Mage.Sets/src/mage/sets/conspiracy/DackFayden.java index 0ad44a2f54..e9d62fe6ab 100644 --- a/Mage.Sets/src/mage/sets/conspiracy/DackFayden.java +++ b/Mage.Sets/src/mage/sets/conspiracy/DackFayden.java @@ -54,6 +54,7 @@ import mage.counters.CounterType; import mage.game.Game; import mage.game.command.Emblem; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.stack.Spell; import mage.players.Player; @@ -129,6 +130,11 @@ class DackFaydenEmblemTriggeredAbility extends TriggeredAbilityImpl { public DackFaydenEmblemTriggeredAbility copy() { return new DackFaydenEmblemTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } @Override public boolean checkTrigger(GameEvent event, Game game) { @@ -136,7 +142,7 @@ class DackFaydenEmblemTriggeredAbility extends TriggeredAbilityImpl { List targettedPermanents = new ArrayList<>(0); Player player = game.getPlayer(this.getControllerId()); if (player != null) { - if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(this.getControllerId())) { + if (event.getPlayerId().equals(this.getControllerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null) { SpellAbility spellAbility = spell.getSpellAbility(); diff --git a/Mage.Sets/src/mage/sets/darkascension/AvacynsCollar.java b/Mage.Sets/src/mage/sets/darkascension/AvacynsCollar.java index a4fc613a6b..40064cb858 100644 --- a/Mage.Sets/src/mage/sets/darkascension/AvacynsCollar.java +++ b/Mage.Sets/src/mage/sets/darkascension/AvacynsCollar.java @@ -28,11 +28,6 @@ package mage.sets.darkascension; import java.util.UUID; -import mage.constants.AttachmentType; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; @@ -42,8 +37,14 @@ import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.EquipAbility; import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.game.permanent.token.SpiritWhiteToken; @@ -93,9 +94,14 @@ class AvacynsCollarTriggeredAbility extends TriggeredAbilityImpl { return new AvacynsCollarTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { + if (((ZoneChangeEvent) event).isDiesEvent()) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (permanent.getAttachments().contains(this.getSourceId()) && permanent.hasSubtype("Human")) { return true; diff --git a/Mage.Sets/src/mage/sets/darkascension/CurseOfThirst.java b/Mage.Sets/src/mage/sets/darkascension/CurseOfThirst.java index 3fcdd765c3..9a5b75ad48 100644 --- a/Mage.Sets/src/mage/sets/darkascension/CurseOfThirst.java +++ b/Mage.Sets/src/mage/sets/darkascension/CurseOfThirst.java @@ -27,6 +27,7 @@ */ package mage.sets.darkascension; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.dynamicvalue.DynamicValue; @@ -41,13 +42,12 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPlayer; import mage.target.targetpointer.FixedTarget; -import java.util.UUID; - /** * * @author BetaSteward @@ -97,16 +97,19 @@ class CurseOfThirstAbility extends TriggeredAbilityImpl { return new CurseOfThirstAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) { - Permanent enchantment = game.getPermanent(this.sourceId); - if (enchantment != null && enchantment.getAttachedTo() != null) { - Player player = game.getPlayer(enchantment.getAttachedTo()); - if (player != null && game.getActivePlayerId().equals(player.getId())) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId())); - return true; - } + Permanent enchantment = game.getPermanent(this.sourceId); + if (enchantment != null && enchantment.getAttachedTo() != null) { + Player player = game.getPlayer(enchantment.getAttachedTo()); + if (player != null && game.getActivePlayerId().equals(player.getId())) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId())); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/darkascension/DiregrafCaptain.java b/Mage.Sets/src/mage/sets/darkascension/DiregrafCaptain.java index 1feaf48955..ccbb3cf69f 100644 --- a/Mage.Sets/src/mage/sets/darkascension/DiregrafCaptain.java +++ b/Mage.Sets/src/mage/sets/darkascension/DiregrafCaptain.java @@ -27,8 +27,7 @@ */ package mage.sets.darkascension; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; @@ -36,18 +35,19 @@ import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.abilities.keyword.DeathtouchAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.target.common.TargetOpponent; -import java.util.UUID; - /** * * @author Loki @@ -103,9 +103,14 @@ class DiregrafCaptainTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) { + if (!event.getTargetId().equals(this.getSourceId())) { ZoneChangeEvent zEvent = (ZoneChangeEvent)event; if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); diff --git a/Mage.Sets/src/mage/sets/darkascension/DrogskolReaver.java b/Mage.Sets/src/mage/sets/darkascension/DrogskolReaver.java index 67978444b9..a3198b7d86 100644 --- a/Mage.Sets/src/mage/sets/darkascension/DrogskolReaver.java +++ b/Mage.Sets/src/mage/sets/darkascension/DrogskolReaver.java @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -87,9 +88,14 @@ class DrogskolReaverAbility extends TriggeredAbilityImpl { return new DrogskolReaverAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.GAINED_LIFE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.GAINED_LIFE && event.getPlayerId().equals(controllerId); + return event.getPlayerId().equals(controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/darkascension/FlayerOfTheHatebound.java b/Mage.Sets/src/mage/sets/darkascension/FlayerOfTheHatebound.java index d629ffaace..41e66775f0 100644 --- a/Mage.Sets/src/mage/sets/darkascension/FlayerOfTheHatebound.java +++ b/Mage.Sets/src/mage/sets/darkascension/FlayerOfTheHatebound.java @@ -27,8 +27,7 @@ */ package mage.sets.darkascension; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -36,17 +35,18 @@ import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.UndyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCreatureOrPlayer; -import java.util.UUID; -import mage.game.events.EntersTheBattlefieldEvent; - /** * * @author BetaSteward @@ -89,17 +89,20 @@ class FlayerTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - Permanent permanent = game.getPermanent(event.getTargetId()); - if (((EntersTheBattlefieldEvent) event).getFromZone() == Zone.GRAVEYARD - && permanent.getOwnerId().equals(controllerId) - && permanent.getCardType().contains(CardType.CREATURE)) { - Effect effect = this.getEffects().get(0); - effect.setValue("damageSource", event.getTargetId()); - return true; - } + Permanent permanent = game.getPermanent(event.getTargetId()); + if (((EntersTheBattlefieldEvent) event).getFromZone() == Zone.GRAVEYARD + && permanent.getOwnerId().equals(controllerId) + && permanent.getCardType().contains(CardType.CREATURE)) { + Effect effect = this.getEffects().get(0); + effect.setValue("damageSource", event.getTargetId()); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/darkascension/HavengulLich.java b/Mage.Sets/src/mage/sets/darkascension/HavengulLich.java index 33c7c884a2..61935aede9 100644 --- a/Mage.Sets/src/mage/sets/darkascension/HavengulLich.java +++ b/Mage.Sets/src/mage/sets/darkascension/HavengulLich.java @@ -51,6 +51,7 @@ import mage.filter.FilterCard; import mage.filter.common.FilterCreatureCard; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.common.TargetCardInGraveyard; @@ -169,9 +170,14 @@ class HavengulLichDelayedTriggeredAbility extends DelayedTriggeredAbility { this.cardId = ability.cardId; } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.SPELL_CAST && event.getSourceId().equals(cardId); + return event.getSourceId().equals(cardId); } @Override diff --git a/Mage.Sets/src/mage/sets/darkascension/Hellrider.java b/Mage.Sets/src/mage/sets/darkascension/Hellrider.java index b2915a627b..54fe016e31 100644 --- a/Mage.Sets/src/mage/sets/darkascension/Hellrider.java +++ b/Mage.Sets/src/mage/sets/darkascension/Hellrider.java @@ -28,16 +28,17 @@ package mage.sets.darkascension; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.keyword.HasteAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -85,15 +86,18 @@ class HellriderTriggeredAbility extends TriggeredAbilityImpl { return new HellriderTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) { - Permanent source = game.getPermanent(event.getSourceId()); - if (source != null && source.getControllerId().equals(controllerId)) { - UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(event.getSourceId(), game); - this.getEffects().get(0).setTargetPointer(new FixedTarget(defendingPlayerId)); - return true; - } + Permanent source = game.getPermanent(event.getSourceId()); + if (source != null && source.getControllerId().equals(controllerId)) { + UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(event.getSourceId(), game); + this.getEffects().get(0).setTargetPointer(new FixedTarget(defendingPlayerId)); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java b/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java index 6f1eac04a6..4e2890e640 100644 --- a/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java +++ b/Mage.Sets/src/mage/sets/darkascension/JarOfEyeballs.java @@ -28,10 +28,6 @@ package mage.sets.darkascension; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleActivatedAbility; @@ -45,10 +41,15 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.FilterCard; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -100,10 +101,14 @@ class JarOfEyeballsTriggeredAbility extends TriggeredAbilityImpl { return new JarOfEyeballsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE - && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD + if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (permanent.getControllerId().equals(this.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE)) { diff --git a/Mage.Sets/src/mage/sets/darkascension/Shriekgeist.java b/Mage.Sets/src/mage/sets/darkascension/Shriekgeist.java index 7fb564d35a..e03da865fa 100644 --- a/Mage.Sets/src/mage/sets/darkascension/Shriekgeist.java +++ b/Mage.Sets/src/mage/sets/darkascension/Shriekgeist.java @@ -28,18 +28,19 @@ package mage.sets.darkascension; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -86,16 +87,19 @@ class ShriekgeistTriggeredAbility extends TriggeredAbilityImpl { return new ShriekgeistTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; - if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - return true; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/darkascension/SoulSeizer.java b/Mage.Sets/src/mage/sets/darkascension/SoulSeizer.java index fb1853dca4..02e4cb5f09 100644 --- a/Mage.Sets/src/mage/sets/darkascension/SoulSeizer.java +++ b/Mage.Sets/src/mage/sets/darkascension/SoulSeizer.java @@ -28,10 +28,6 @@ package mage.sets.darkascension; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -39,12 +35,16 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.TransformAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCreaturePermanent; @@ -99,19 +99,22 @@ class SoulSeizerTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) { - Player opponent = game.getPlayer(event.getPlayerId()); - if (opponent != null) { - FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls"); - filter.add(new ControllerIdPredicate(opponent.getId())); + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } - this.getTargets().clear(); - this.addTarget(new TargetCreaturePermanent(filter)); - return true; - } + @Override + public boolean checkTrigger(GameEvent event, Game game) { + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) { + Player opponent = game.getPlayer(event.getPlayerId()); + if (opponent != null) { + FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls"); + filter.add(new ControllerIdPredicate(opponent.getId())); + + this.getTargets().clear(); + this.addTarget(new TargetCreaturePermanent(filter)); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/darkascension/SpitefulShadows.java b/Mage.Sets/src/mage/sets/darkascension/SpitefulShadows.java index 08df247c52..0d273b38a4 100644 --- a/Mage.Sets/src/mage/sets/darkascension/SpitefulShadows.java +++ b/Mage.Sets/src/mage/sets/darkascension/SpitefulShadows.java @@ -28,18 +28,19 @@ package mage.sets.darkascension; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; @@ -92,16 +93,19 @@ class SpitefulShadowsTriggeredAbility extends TriggeredAbilityImpl { return new SpitefulShadowsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) { - Permanent enchantment = game.getPermanent(sourceId); - UUID targetId = event.getTargetId(); - if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) { - this.getEffects().get(0).setValue("damageAmount", event.getAmount()); - this.getEffects().get(0).setTargetPointer(new FixedTarget(targetId)); - return true; - } + Permanent enchantment = game.getPermanent(sourceId); + UUID targetId = event.getTargetId(); + if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) { + this.getEffects().get(0).setValue("damageAmount", event.getAmount()); + this.getEffects().get(0).setTargetPointer(new FixedTarget(targetId)); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/darkascension/TovolarsMagehunter.java b/Mage.Sets/src/mage/sets/darkascension/TovolarsMagehunter.java index 2ef04e4c7b..43246ddf7e 100644 --- a/Mage.Sets/src/mage/sets/darkascension/TovolarsMagehunter.java +++ b/Mage.Sets/src/mage/sets/darkascension/TovolarsMagehunter.java @@ -28,10 +28,6 @@ package mage.sets.darkascension; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.TargetController; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbility; import mage.abilities.TriggeredAbilityImpl; @@ -42,8 +38,13 @@ import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.TransformSourceEffect; import mage.abilities.keyword.TransformAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -99,9 +100,14 @@ class TovolarsMagehunterTriggeredAbility extends TriggeredAbilityImpl { return new TovolarsMagehunterTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST && game.getOpponents(controllerId).contains(event.getPlayerId())) { + if (game.getOpponents(controllerId).contains(event.getPlayerId())) { this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); return true; } diff --git a/Mage.Sets/src/mage/sets/darkascension/WerewolfRansacker.java b/Mage.Sets/src/mage/sets/darkascension/WerewolfRansacker.java index 20b2619b74..bf1a2905c5 100644 --- a/Mage.Sets/src/mage/sets/darkascension/WerewolfRansacker.java +++ b/Mage.Sets/src/mage/sets/darkascension/WerewolfRansacker.java @@ -28,7 +28,6 @@ package mage.sets.darkascension; import java.util.UUID; -import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbility; @@ -42,11 +41,15 @@ import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.common.TransformSourceEffect; import mage.abilities.keyword.TransformAbility; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; import mage.filter.common.FilterArtifactPermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; @@ -108,13 +111,17 @@ class WerewolfRansackerAbility extends TriggeredAbilityImpl { return new WerewolfRansackerAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TRANSFORMED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TRANSFORMED) { - if (event.getTargetId().equals(sourceId)) { - Permanent permanent = game.getPermanent(sourceId); - if (permanent != null && permanent.isTransformed()) - return true; + if (event.getTargetId().equals(sourceId)) { + Permanent permanent = game.getPermanent(sourceId); + if (permanent != null && permanent.isTransformed()) { + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/darkascension/WithengarUnbound.java b/Mage.Sets/src/mage/sets/darkascension/WithengarUnbound.java index 95c340d8b7..6803181b75 100644 --- a/Mage.Sets/src/mage/sets/darkascension/WithengarUnbound.java +++ b/Mage.Sets/src/mage/sets/darkascension/WithengarUnbound.java @@ -28,9 +28,6 @@ package mage.sets.darkascension; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.counter.AddCountersSourceEffect; @@ -38,10 +35,13 @@ import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.IntimidateAbility; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -96,11 +96,14 @@ class WithengarUnboundTriggeredAbility extends TriggeredAbilityImpl { return new WithengarUnboundTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.LOST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.LOST) - return true; - return false; + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/darksteel/LichsTomb.java b/Mage.Sets/src/mage/sets/darksteel/LichsTomb.java index 522a57acdd..3ec918d011 100644 --- a/Mage.Sets/src/mage/sets/darksteel/LichsTomb.java +++ b/Mage.Sets/src/mage/sets/darksteel/LichsTomb.java @@ -85,10 +85,15 @@ class LichsTombTriggeredAbility extends TriggeredAbilityImpl { public LichsTombTriggeredAbility copy() { return new LichsTombTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.LOST_LIFE; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.LOST_LIFE && event.getPlayerId() == this.getControllerId()) { + if (event.getPlayerId() == this.getControllerId()) { ((SacrificeEffect) this.getEffects().get(0)).setAmount(new StaticValue(event.getAmount())); return true; } diff --git a/Mage.Sets/src/mage/sets/darksteel/SwordOfFireAndIce.java b/Mage.Sets/src/mage/sets/darksteel/SwordOfFireAndIce.java index e519e61777..7843ac73fc 100644 --- a/Mage.Sets/src/mage/sets/darksteel/SwordOfFireAndIce.java +++ b/Mage.Sets/src/mage/sets/darksteel/SwordOfFireAndIce.java @@ -29,12 +29,6 @@ package mage.sets.darksteel; import java.util.UUID; - -import mage.constants.AttachmentType; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.ObjectColor; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; @@ -46,12 +40,18 @@ import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.EquipAbility; import mage.abilities.keyword.ProtectionAbility; import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.common.TargetCreatureOrPlayer; @@ -111,16 +111,16 @@ class SwordOfFireAndIceAbility extends TriggeredAbilityImpl { return new SwordOfFireAndIceAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; - Permanent p = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { - return true; - } - } - return false; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + Permanent p = game.getPermanent(event.getSourceId()); + return damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/darksteel/SwordOfLightAndShadow.java b/Mage.Sets/src/mage/sets/darksteel/SwordOfLightAndShadow.java index b4be8adc41..1d4414a3c4 100644 --- a/Mage.Sets/src/mage/sets/darksteel/SwordOfLightAndShadow.java +++ b/Mage.Sets/src/mage/sets/darksteel/SwordOfLightAndShadow.java @@ -55,6 +55,7 @@ import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCardInYourGraveyard; @@ -129,16 +130,16 @@ class SwordOfLightAndShadowAbility extends TriggeredAbilityImpl { return new SwordOfLightAndShadowAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; - Permanent p = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { - return true; - } - } - return false; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + Permanent p = game.getPermanent(event.getSourceId()); + return damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/dissension/ProperBurial.java b/Mage.Sets/src/mage/sets/dissension/ProperBurial.java index e09d61985e..a63d354ae5 100644 --- a/Mage.Sets/src/mage/sets/dissension/ProperBurial.java +++ b/Mage.Sets/src/mage/sets/dissension/ProperBurial.java @@ -28,14 +28,15 @@ package mage.sets.dissension; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; @@ -79,10 +80,14 @@ class ProperBurialTriggeredAbility extends TriggeredAbilityImpl { return new ProperBurialTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE - && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD + if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (permanent.getControllerId().equals(this.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE)) { diff --git a/Mage.Sets/src/mage/sets/dissension/UtopiaSprawl.java b/Mage.Sets/src/mage/sets/dissension/UtopiaSprawl.java index c2a687e9e8..c92e93989b 100644 --- a/Mage.Sets/src/mage/sets/dissension/UtopiaSprawl.java +++ b/Mage.Sets/src/mage/sets/dissension/UtopiaSprawl.java @@ -28,10 +28,6 @@ package mage.sets.dissension; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.Mana; import mage.ObjectColor; import mage.abilities.Ability; @@ -43,12 +39,16 @@ import mage.abilities.keyword.EnchantAbility; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; import mage.choices.ChoiceColor; +import mage.constants.CardType; import mage.constants.ColoredManaSymbol; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterLandPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; @@ -138,14 +138,17 @@ class UtopiaSprawlTriggeredAbility extends TriggeredManaAbility { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); - if(event.getType() == GameEvent.EventType.TAPPED_FOR_MANA){ - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - return true; - } - } + if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { + return true; + } return false; } diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/BeckCall.java b/Mage.Sets/src/mage/sets/dragonsmaze/BeckCall.java index ad25ec436b..8bed02cb90 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/BeckCall.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/BeckCall.java @@ -29,24 +29,20 @@ package mage.sets.dragonsmaze; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.SplitCard; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; -/** - * - * @author LevelX2 - */ public class BeckCall extends SplitCard { @@ -88,14 +84,17 @@ class BeckTriggeredAbility extends DelayedTriggeredAbility { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - UUID targetId = event.getTargetId(); - Permanent permanent = game.getPermanent(targetId); - if (filter.match(permanent, getSourceId(), getControllerId(), game)) { - return true; - } + UUID targetId = event.getTargetId(); + Permanent permanent = game.getPermanent(targetId); + if (filter.match(permanent, getSourceId(), getControllerId(), game)) { + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/BredForTheHunt.java b/Mage.Sets/src/mage/sets/dragonsmaze/BredForTheHunt.java index bcac27da9b..2deae6da5c 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/BredForTheHunt.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/BredForTheHunt.java @@ -28,22 +28,19 @@ package mage.sets.dragonsmaze; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; -import mage.game.events.DamagedPlayerEvent; +import mage.game.events.DamagedEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; -/** - * - * @author LevelX2 - */ public class BredForTheHunt extends CardImpl { @@ -83,9 +80,14 @@ class BredForTheHuntTriggeredAbility extends TriggeredAbilityImpl { return new BredForTheHuntTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && ((DamagedPlayerEvent) event).isCombatDamage()) { + if (((DamagedEvent) event).isCombatDamage()) { Permanent creature = game.getPermanent(event.getSourceId()); if (creature != null && creature.getControllerId().equals(getControllerId()) && creature.getCounters().getCount(CounterType.P1P1) > 0) { return true; diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/CarnageGladiator.java b/Mage.Sets/src/mage/sets/dragonsmaze/CarnageGladiator.java index 865e8d8b75..452b6a2a43 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/CarnageGladiator.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/CarnageGladiator.java @@ -29,10 +29,6 @@ package mage.sets.dragonsmaze; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleActivatedAbility; @@ -40,15 +36,15 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.RegenerateSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; -/** - * - * @author LevelX2 - */ public class CarnageGladiator extends CardImpl { @@ -97,14 +93,17 @@ class CarnageGladiatorTriggeredAbility extends TriggeredAbilityImpl { return new CarnageGladiatorTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BLOCKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) { - Permanent blocker = game.getPermanent(event.getSourceId()); - if (blocker != null) { - getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getControllerId())); - return true; - } + Permanent blocker = game.getPermanent(event.getSourceId()); + if (blocker != null) { + getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getControllerId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/MasterOfCruelties.java b/Mage.Sets/src/mage/sets/dragonsmaze/MasterOfCruelties.java index ff74e7bdac..776570e5a0 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/MasterOfCruelties.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/MasterOfCruelties.java @@ -28,25 +28,25 @@ package mage.sets.dragonsmaze; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.keyword.CanAttackOnlyAloneAbility; -import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.DeathtouchAbility; +import mage.abilities.keyword.FirstStrikeAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.combat.CombatGroup; import mage.game.events.DamageEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; @@ -102,18 +102,21 @@ class MasterOfCrueltiesTriggeredAbility extends TriggeredAbilityImpl { return new MasterOfCrueltiesTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_BLOCKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DECLARED_BLOCKERS) { - Permanent sourcePermanent = game.getPermanent(getSourceId()); - if (sourcePermanent.isAttacking()) { - for (CombatGroup combatGroup: game.getCombat().getGroups()) { - if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) { - // check if a player is attacked (instead of a planeswalker) - Player defendingPlayer = game.getPlayer(combatGroup.getDefenderId()); - if (defendingPlayer != null) { - return true; - } + Permanent sourcePermanent = game.getPermanent(getSourceId()); + if (sourcePermanent.isAttacking()) { + for (CombatGroup combatGroup: game.getCombat().getGroups()) { + if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) { + // check if a player is attacked (instead of a planeswalker) + Player defendingPlayer = game.getPlayer(combatGroup.getDefenderId()); + if (defendingPlayer != null) { + return true; } } } diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/MelekIzzetParagon.java b/Mage.Sets/src/mage/sets/dragonsmaze/MelekIzzetParagon.java index 86ab55c65f..f174c83e2f 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/MelekIzzetParagon.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/MelekIzzetParagon.java @@ -28,10 +28,6 @@ package mage.sets.dragonsmaze; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; @@ -40,6 +36,9 @@ import mage.abilities.effects.common.CopyTargetSpellEffect; import mage.abilities.effects.common.continuous.PlayTheTopCardEffect; import mage.abilities.effects.common.continuous.PlayWithTheTopCardRevealedEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; @@ -108,10 +107,14 @@ class MelekIzzetParagonTriggeredAbility extends TriggeredAbilityImpl { return new MelekIzzetParagonTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.SPELL_CAST - && event.getZone() == Zone.LIBRARY) { + if (event.getZone() == Zone.LIBRARY) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && spell.getControllerId().equals(super.getControllerId()) diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/PyrewildShaman.java b/Mage.Sets/src/mage/sets/dragonsmaze/PyrewildShaman.java index a03b595e71..bc2c1c6014 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/PyrewildShaman.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/PyrewildShaman.java @@ -31,10 +31,6 @@ package mage.sets.dragonsmaze; import java.util.ArrayList; import java.util.List; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.ManaCostsImpl; @@ -43,16 +39,17 @@ import mage.abilities.effects.common.ReturnToHandSourceEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.keyword.BloodrushAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; -import mage.game.events.DamagedPlayerEvent; +import mage.game.events.DamagedEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; -/** - * - * @author LevelX2 - */ public class PyrewildShaman extends CardImpl { @@ -102,10 +99,17 @@ class PyrewildShamanTriggeredAbility extends TriggeredAbilityImpl { return new PyrewildShamanTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER + || event.getType() == EventType.END_COMBAT_STEP_POST + || event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { - if (((DamagedPlayerEvent) event).isCombatDamage()) { + if (((DamagedEvent) event).isCombatDamage()) { Permanent creature = game.getPermanent(event.getSourceId()); if (creature != null && creature.getControllerId().equals(controllerId) && !damagedPlayerIds.contains(event.getTargetId())) { damagedPlayerIds.add(event.getTargetId()); diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/RenegadeKrasis.java b/Mage.Sets/src/mage/sets/dragonsmaze/RenegadeKrasis.java index efafb1dac5..6bd8f47bef 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/RenegadeKrasis.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/RenegadeKrasis.java @@ -29,26 +29,23 @@ package mage.sets.dragonsmaze; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.counter.AddCountersAllEffect; import mage.abilities.keyword.EvolveAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.CounterPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.StackObject; -/** - * - * @author LevelX2 - */ public class RenegadeKrasis extends CardImpl { @@ -101,10 +98,14 @@ class RenegadeKrasisTriggeredAbility extends TriggeredAbilityImpl { return new RenegadeKrasisTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.COUNTER_ADDED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(GameEvent.EventType.COUNTER_ADDED) - && event.getTargetId().equals(getSourceId())) { + if (event.getTargetId().equals(getSourceId())) { Object object = game.getState().getValue("EvolveAddCounterActive"); if (object != null && (Boolean) object) { StackObject stackObject = game.getStack().getLast(); diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/RuricTharTheUnbowed.java b/Mage.Sets/src/mage/sets/dragonsmaze/RuricTharTheUnbowed.java index 161f0aa220..9dbc81fb42 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/RuricTharTheUnbowed.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/RuricTharTheUnbowed.java @@ -28,20 +28,20 @@ package mage.sets.dragonsmaze; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.AttacksEachTurnStaticAbility; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; -import mage.abilities.keyword.VigilanceAbility; import mage.abilities.keyword.ReachAbility; +import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.target.targetpointer.FixedTarget; @@ -99,18 +99,20 @@ class RuricTharTheUnbowedAbility extends TriggeredAbilityImpl { return new RuricTharTheUnbowedAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null - && !spell.getCardType().contains(CardType.CREATURE)) { + if (spell != null && !spell.getCardType().contains(CardType.CREATURE)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } return true; } - } return false; } diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/VoiceOfResurgence.java b/Mage.Sets/src/mage/sets/dragonsmaze/VoiceOfResurgence.java index bad8df6dab..8bebbae8f2 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/VoiceOfResurgence.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/VoiceOfResurgence.java @@ -29,7 +29,6 @@ package mage.sets.dragonsmaze; import java.util.UUID; import mage.MageInt; -import mage.MageObject; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.DynamicValue; @@ -45,6 +44,7 @@ import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.token.Token; import mage.game.stack.Spell; @@ -88,6 +88,11 @@ class VoiceOfResurgenceTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST || event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { // Opponent casts spell during your turn diff --git a/Mage.Sets/src/mage/sets/dragonsmaze/ZhurTaaDruid.java b/Mage.Sets/src/mage/sets/dragonsmaze/ZhurTaaDruid.java index 844cfa4b97..783fafd52f 100644 --- a/Mage.Sets/src/mage/sets/dragonsmaze/ZhurTaaDruid.java +++ b/Mage.Sets/src/mage/sets/dragonsmaze/ZhurTaaDruid.java @@ -28,17 +28,18 @@ package mage.sets.dragonsmaze; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.TargetController; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DamagePlayersEffect; import mage.abilities.mana.GreenManaAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -82,12 +83,14 @@ class ZhurTaaDruidAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TAPPED_FOR_MANA && event.getSourceId().equals(getSourceId())) { - return true; - } - return false; + return event.getSourceId().equals(getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/ArashinForemost.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/ArashinForemost.java index 786d8eb7b9..46169d9541 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/ArashinForemost.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/ArashinForemost.java @@ -38,11 +38,11 @@ import mage.constants.Duration; import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetControlledCreaturePermanent; /** @@ -99,6 +99,11 @@ class ArashinForemostAbility extends TriggeredAbilityImpl { return new ArashinForemostAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/FoeRazerRegent.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/FoeRazerRegent.java index 93568ecf4f..9e801b7b50 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/FoeRazerRegent.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/FoeRazerRegent.java @@ -34,14 +34,12 @@ import mage.abilities.DelayedTriggeredAbility; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; import mage.abilities.effects.common.FightTargetSourceEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.TargetController; import mage.constants.Zone; @@ -149,17 +147,18 @@ class FoeRazerRegentDelayedTriggeredAbility extends DelayedTriggeredAbility { return new FoeRazerRegentDelayedTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.END_TURN_STEP_PRE) { - return true; - } - return false; + return true; } @Override public String getRule() { return "put two +1/+1 counters on it at the beginning of the next end step"; } - } diff --git a/Mage.Sets/src/mage/sets/dragonsoftarkir/RuthlessDeathfang.java b/Mage.Sets/src/mage/sets/dragonsoftarkir/RuthlessDeathfang.java index aa633789f0..b3385304d2 100644 --- a/Mage.Sets/src/mage/sets/dragonsoftarkir/RuthlessDeathfang.java +++ b/Mage.Sets/src/mage/sets/dragonsoftarkir/RuthlessDeathfang.java @@ -40,6 +40,7 @@ import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetOpponent; /** @@ -89,14 +90,15 @@ class RuthlessDeathfangTriggeredAbility extends TriggeredAbilityImpl { return new RuthlessDeathfangTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SACRIFICED_PERMANENT; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT - && event.getPlayerId().equals(this.getControllerId()) - && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getCardType().contains(CardType.CREATURE)) { - return true; - } - return false; + return event.getPlayerId().equals(this.getControllerId()) + && game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getCardType().contains(CardType.CREATURE); } @Override diff --git a/Mage.Sets/src/mage/sets/eventide/AshlingTheExtinguisher.java b/Mage.Sets/src/mage/sets/eventide/AshlingTheExtinguisher.java index dea771ba4b..3b525f2212 100644 --- a/Mage.Sets/src/mage/sets/eventide/AshlingTheExtinguisher.java +++ b/Mage.Sets/src/mage/sets/eventide/AshlingTheExtinguisher.java @@ -29,19 +29,19 @@ package mage.sets.eventide; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.SacrificeTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.common.TargetCreaturePermanent; @@ -90,19 +90,22 @@ class AshlingTheExtinguisherTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) { - Player opponent = game.getPlayer(event.getPlayerId()); - if (opponent != null) { - FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls"); - filter.add(new ControllerIdPredicate(opponent.getId())); + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } - this.getTargets().clear(); - this.addTarget(new TargetCreaturePermanent(filter)); - return true; - } + @Override + public boolean checkTrigger(GameEvent event, Game game) { + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) { + Player opponent = game.getPlayer(event.getPlayerId()); + if (opponent != null) { + FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls"); + filter.add(new ControllerIdPredicate(opponent.getId())); + + this.getTargets().clear(); + this.addTarget(new TargetCreaturePermanent(filter)); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/eventide/Necroskitter.java b/Mage.Sets/src/mage/sets/eventide/Necroskitter.java index 0b71d9524b..5d67ee26cc 100644 --- a/Mage.Sets/src/mage/sets/eventide/Necroskitter.java +++ b/Mage.Sets/src/mage/sets/eventide/Necroskitter.java @@ -40,6 +40,7 @@ import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -91,25 +92,28 @@ class NecroskitterTriggeredAbility extends TriggeredAbilityImpl { return new NecroskitterTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (game.getPermanent(sourceId) == null) { - if (game.getLastKnownInformation(sourceId, Zone.BATTLEFIELD) == null) { - return false; - } + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (game.getPermanent(sourceId) == null) { + if (game.getLastKnownInformation(sourceId, Zone.BATTLEFIELD) == null) { + return false; } - if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { - Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (permanent != null - && permanent.getCounters().containsKey(CounterType.M1M1) - && game.getOpponents(controllerId).contains(permanent.getControllerId())) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - } - return true; + } + if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { + Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + if (permanent != null + && permanent.getCounters().containsKey(CounterType.M1M1) + && game.getOpponents(controllerId).contains(permanent.getControllerId())) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/eventide/Spitemare.java b/Mage.Sets/src/mage/sets/eventide/Spitemare.java index e1f0be4bf9..0f121a7a96 100644 --- a/Mage.Sets/src/mage/sets/eventide/Spitemare.java +++ b/Mage.Sets/src/mage/sets/eventide/Spitemare.java @@ -39,6 +39,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.common.TargetCreatureOrPlayer; @@ -88,9 +89,14 @@ class SpitemareTriggeredAbility extends TriggeredAbilityImpl { return new SpitemareTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId)) { + if (event.getTargetId().equals(this.sourceId)) { this.getEffects().get(0).setValue("damageAmount", event.getAmount()); return true; } diff --git a/Mage.Sets/src/mage/sets/eventide/WakeThrasher.java b/Mage.Sets/src/mage/sets/eventide/WakeThrasher.java index c98427c63e..b2b2cd080a 100644 --- a/Mage.Sets/src/mage/sets/eventide/WakeThrasher.java +++ b/Mage.Sets/src/mage/sets/eventide/WakeThrasher.java @@ -28,18 +28,18 @@ package mage.sets.eventide; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -86,12 +86,14 @@ class BecomesUntappedControlledPermanentTriggeredAbility extends TriggeredAbilit return new BecomesUntappedControlledPermanentTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UNTAPPED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UNTAPPED && game.getPermanent(event.getTargetId()).getControllerId().equals(this.controllerId)) { - return true; - } - return false; + return game.getPermanent(event.getTargetId()).getControllerId().equals(this.controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/eventide/WavesOfAggression.java b/Mage.Sets/src/mage/sets/eventide/WavesOfAggression.java index c41dc5fdfa..8b0ee76554 100644 --- a/Mage.Sets/src/mage/sets/eventide/WavesOfAggression.java +++ b/Mage.Sets/src/mage/sets/eventide/WavesOfAggression.java @@ -41,6 +41,7 @@ import mage.constants.Rarity; import mage.constants.TurnPhase; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.turn.TurnMod; import mage.watchers.Watcher; @@ -162,6 +163,11 @@ class WavesOfAggressionDelayedAddMainPhaseAbility extends DelayedTriggeredAbilit return new WavesOfAggressionDelayedAddMainPhaseAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.PHASE_CHANGED || event.getType() == EventType.COMBAT_PHASE_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.PHASE_CHANGED && this.connectedTurnMod.equals(event.getSourceId())) { diff --git a/Mage.Sets/src/mage/sets/exodus/CityOfTraitors.java b/Mage.Sets/src/mage/sets/exodus/CityOfTraitors.java index 0659cbd5c0..07d2ccdfd6 100644 --- a/Mage.Sets/src/mage/sets/exodus/CityOfTraitors.java +++ b/Mage.Sets/src/mage/sets/exodus/CityOfTraitors.java @@ -28,18 +28,18 @@ package mage.sets.exodus; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.Mana; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.mana.SimpleManaAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -79,17 +79,17 @@ class CityOfTraitorsTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.LAND_PLAYED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.LAND_PLAYED) { - Permanent land = game.getPermanent(event.getTargetId()); - if (land.getCardType().contains(CardType.LAND) - && land.getControllerId().equals(this.controllerId) - && event.getTargetId() != this.getSourceId()) { - return true; - } - } - return false; + Permanent land = game.getPermanent(event.getTargetId()); + return land.getCardType().contains(CardType.LAND) + && land.getControllerId().equals(this.controllerId) + && event.getTargetId() != this.getSourceId(); } @Override diff --git a/Mage.Sets/src/mage/sets/exodus/SoltariVisionary.java b/Mage.Sets/src/mage/sets/exodus/SoltariVisionary.java index 6e9b73d8b8..4e07f51447 100644 --- a/Mage.Sets/src/mage/sets/exodus/SoltariVisionary.java +++ b/Mage.Sets/src/mage/sets/exodus/SoltariVisionary.java @@ -28,19 +28,19 @@ package mage.sets.exodus; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.ShadowAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterEnchantmentPermanent; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; -import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; @@ -91,18 +91,21 @@ class SoltariVisionaryTriggeredAbility extends TriggeredAbilityImpl { return new SoltariVisionaryTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - Permanent soltari = game.getPermanent(event.getSourceId()); - if (soltari != null && soltari.getId() == this.getSourceId()) { - FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent("enchantment that player controls."); - filter.add(new ControllerIdPredicate(event.getPlayerId())); - filter.setMessage("enchantment controlled by " + game.getPlayer(event.getTargetId()).getLogName()); - this.getTargets().clear(); - this.addTarget(new TargetPermanent(filter)); - return true; - } + Permanent soltari = game.getPermanent(event.getSourceId()); + if (soltari != null && soltari.getId() == this.getSourceId()) { + FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent("enchantment that player controls."); + filter.add(new ControllerIdPredicate(event.getPlayerId())); + filter.setMessage("enchantment controlled by " + game.getPlayer(event.getTargetId()).getLogName()); + this.getTargets().clear(); + this.addTarget(new TargetPermanent(filter)); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/fallenempires/HighTide.java b/Mage.Sets/src/mage/sets/fallenempires/HighTide.java index e4a947dc8a..a05092aa2e 100644 --- a/Mage.Sets/src/mage/sets/fallenempires/HighTide.java +++ b/Mage.Sets/src/mage/sets/fallenempires/HighTide.java @@ -28,21 +28,21 @@ package mage.sets.fallenempires; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.Mana; import mage.abilities.effects.Effect; import mage.abilities.effects.common.AddManaToManaPoolTargetControllerEffect; import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; import mage.abilities.mana.DelayedTriggeredManaAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.ColoredManaSymbol; import mage.constants.Duration; +import mage.constants.Rarity; import mage.filter.common.FilterLandPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -56,10 +56,9 @@ public class HighTide extends CardImpl { super(ownerId, 35, "High Tide", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{U}"); this.expansionSetCode = "FEM"; - // Until end of turn, whenever a player taps an Island for mana, that player adds {U} to his or her mana pool. this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new HighTideTriggeredAbility())); - + } public HighTide(final HighTide card) { @@ -75,9 +74,9 @@ public class HighTide extends CardImpl { class HighTideTriggeredAbility extends DelayedTriggeredManaAbility { private static final FilterLandPermanent filter = new FilterLandPermanent("Island"); - + static { - filter.add(new SubtypePredicate("Island")); + filter.add(new SubtypePredicate("Island")); } public HighTideTriggeredAbility() { @@ -89,10 +88,15 @@ class HighTideTriggeredAbility extends DelayedTriggeredManaAbility { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent land = game.getPermanent(event.getTargetId()); - if (event.getType() == GameEvent.EventType.TAPPED_FOR_MANA && land != null && filter.match(land, game)) { + if (land != null && filter.match(land, game)) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(land.getControllerId())); } diff --git a/Mage.Sets/src/mage/sets/fifthdawn/BlindCreeper.java b/Mage.Sets/src/mage/sets/fifthdawn/BlindCreeper.java index 1999182919..b810c8e726 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/BlindCreeper.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/BlindCreeper.java @@ -28,18 +28,17 @@ package mage.sets.fifthdawn; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; -import mage.game.stack.Spell; +import mage.game.events.GameEvent.EventType; /** * @@ -85,15 +84,14 @@ class BlindCreeperAbility extends TriggeredAbilityImpl { return new BlindCreeperAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null) { - return true; - } - } - return false; + return game.getStack().getSpell(event.getTargetId()) != null; } @Override diff --git a/Mage.Sets/src/mage/sets/fifthdawn/DawnsReflection.java b/Mage.Sets/src/mage/sets/fifthdawn/DawnsReflection.java index 88c61fc57d..8a06a839ef 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/DawnsReflection.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/DawnsReflection.java @@ -42,6 +42,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; @@ -93,15 +94,15 @@ class DawnsReflectionTriggeredAbility extends TriggeredManaAbility { return new DawnsReflectionTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if(event.getType() == GameEvent.EventType.TAPPED_FOR_MANA){ - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - return true; - } - } - return false; + Permanent enchantment = game.getPermanent(this.getSourceId()); + return enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo()); } diff --git a/Mage.Sets/src/mage/sets/fifthdawn/RiteOfPassage.java b/Mage.Sets/src/mage/sets/fifthdawn/RiteOfPassage.java index b67288d236..b0e425fdd1 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/RiteOfPassage.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/RiteOfPassage.java @@ -39,6 +39,7 @@ import mage.counters.CounterType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -87,16 +88,19 @@ class RiteOfPassageTriggeredAbility extends TriggeredAbilityImpl { return new RiteOfPassageTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) { - UUID targetId = event.getTargetId(); - Permanent permanent = game.getPermanent(targetId); - if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - return true; - } + UUID targetId = event.getTargetId(); + Permanent permanent = game.getPermanent(targetId); + if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/fifthedition/Blight.java b/Mage.Sets/src/mage/sets/fifthedition/Blight.java index 252c62715a..dc7821b2b6 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/Blight.java +++ b/Mage.Sets/src/mage/sets/fifthedition/Blight.java @@ -28,9 +28,6 @@ package mage.sets.fifthedition; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; @@ -38,10 +35,13 @@ import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; @@ -89,18 +89,21 @@ class BlightTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TAPPED) { - Permanent enchantment = game.getPermanent(this.sourceId); - if (enchantment != null && enchantment.getAttachedTo().equals(event.getTargetId())) { - Permanent attached = game.getPermanent(enchantment.getAttachedTo()); - if (attached != null) { - for (Effect e : getEffects()) { - e.setTargetPointer(new FixedTarget(attached.getId())); - } - return true; + Permanent enchantment = game.getPermanent(this.sourceId); + if (enchantment != null && enchantment.getAttachedTo().equals(event.getTargetId())) { + Permanent attached = game.getPermanent(enchantment.getAttachedTo()); + if (attached != null) { + for (Effect e : getEffects()) { + e.setTargetPointer(new FixedTarget(attached.getId())); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/fifthedition/Justice.java b/Mage.Sets/src/mage/sets/fifthedition/Justice.java index ffa932141d..0782eddfe8 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/Justice.java +++ b/Mage.Sets/src/mage/sets/fifthedition/Justice.java @@ -27,7 +27,7 @@ */ package mage.sets.fifthedition; -import mage.constants.*; +import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -37,15 +37,19 @@ import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.stack.Spell; import mage.players.Player; import mage.target.targetpointer.FixedTarget; -import java.util.UUID; - /** * * @author jeffwadsworth @@ -89,19 +93,22 @@ class JusticeTriggeredAbility extends TriggeredAbilityImpl { return new JusticeTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE + || event.getType() == EventType.DAMAGED_PLAYER + || event.getType() == EventType.DAMAGED_PLANESWALKER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE - || event.getType() == GameEvent.EventType.DAMAGED_PLAYER - || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER) { - MageObject sourceObject = game.getObject(event.getSourceId()); - if (sourceObject.getColor(game).isRed()) { - if (sourceObject instanceof Permanent && sourceObject.getCardType().contains(CardType.CREATURE) - || sourceObject instanceof Spell) { - this.getEffects().get(0).setValue("damageAmount", event.getAmount()); - this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getControllerId(sourceObject.getId()))); - return true; - } + MageObject sourceObject = game.getObject(event.getSourceId()); + if (sourceObject.getColor(game).isRed()) { + if (sourceObject instanceof Permanent && sourceObject.getCardType().contains(CardType.CREATURE) + || sourceObject instanceof Spell) { + this.getEffects().get(0).setValue("damageAmount", event.getAmount()); + this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getControllerId(sourceObject.getId()))); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/fourthedition/TheRack.java b/Mage.Sets/src/mage/sets/fourthedition/TheRack.java index d87b9cab0b..98b564a6bb 100644 --- a/Mage.Sets/src/mage/sets/fourthedition/TheRack.java +++ b/Mage.Sets/src/mage/sets/fourthedition/TheRack.java @@ -39,6 +39,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetOpponent; @@ -85,12 +86,14 @@ class TheRackTriggeredAbility extends TriggeredAbilityImpl { return new TheRackTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) { - return event.getPlayerId().equals((UUID) game.getState().getValue(new StringBuilder(this.getSourceId().toString()).append("_player").toString())); - } - return false; + return event.getPlayerId().equals((UUID) game.getState().getValue(new StringBuilder(this.getSourceId().toString()).append("_player").toString())); } @Override diff --git a/Mage.Sets/src/mage/sets/futuresight/FrenzySliver.java b/Mage.Sets/src/mage/sets/futuresight/FrenzySliver.java index 893abce967..dd106c5a4a 100644 --- a/Mage.Sets/src/mage/sets/futuresight/FrenzySliver.java +++ b/Mage.Sets/src/mage/sets/futuresight/FrenzySliver.java @@ -43,6 +43,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.combat.CombatGroup; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -99,15 +100,18 @@ class FrenzyAbility extends TriggeredAbilityImpl { return new FrenzyAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_BLOCKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DECLARED_BLOCKERS) { - Permanent sourcePermanent = game.getPermanent(getSourceId()); - if (sourcePermanent.isAttacking()) { - for (CombatGroup combatGroup: game.getCombat().getGroups()) { - if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) { - return true; - } + Permanent sourcePermanent = game.getPermanent(getSourceId()); + if (sourcePermanent.isAttacking()) { + for (CombatGroup combatGroup: game.getCombat().getGroups()) { + if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) { + return true; } } } diff --git a/Mage.Sets/src/mage/sets/futuresight/HeartwoodStoryteller.java b/Mage.Sets/src/mage/sets/futuresight/HeartwoodStoryteller.java index 287277332d..2ae7c2d510 100644 --- a/Mage.Sets/src/mage/sets/futuresight/HeartwoodStoryteller.java +++ b/Mage.Sets/src/mage/sets/futuresight/HeartwoodStoryteller.java @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -85,17 +86,20 @@ class HeartwoodStorytellerTriggeredAbility extends TriggeredAbilityImpl { public HeartwoodStorytellerTriggeredAbility copy() { return new HeartwoodStorytellerTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && !spell.getCardType().contains(CardType.CREATURE)) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - return true; + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null && !spell.getCardType().contains(CardType.CREATURE)) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/gatecrash/AureliaTheWarleader.java b/Mage.Sets/src/mage/sets/gatecrash/AureliaTheWarleader.java index 2a83f0ab87..11cfa55720 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/AureliaTheWarleader.java +++ b/Mage.Sets/src/mage/sets/gatecrash/AureliaTheWarleader.java @@ -28,10 +28,6 @@ package mage.sets.gatecrash; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -43,8 +39,11 @@ import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.VigilanceAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.TurnPhase; +import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; @@ -110,17 +109,22 @@ class AureliaAttacksTriggeredAbility extends TriggeredAbilityImpl { @Override public void reset(Game game) { Card sourceCard = game.getCard(getSourceId()); - game.getState().setValue(getValueKey(sourceCard, game), new Integer(0)); + game.getState().setValue(getValueKey(sourceCard, game), 0); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId()) ) { + if (event.getSourceId().equals(this.getSourceId()) ) { Card sourceCard = game.getCard(getSourceId()); Integer amountAttacks = (Integer) game.getState().getValue(getValueKey(sourceCard, game)); - if (amountAttacks == null || amountAttacks.intValue() < 1) { + if (amountAttacks == null || amountAttacks < 1) { if (amountAttacks == null) { - amountAttacks = new Integer(1); + amountAttacks = 1; } else { ++amountAttacks; } diff --git a/Mage.Sets/src/mage/sets/gatecrash/CryptGhast.java b/Mage.Sets/src/mage/sets/gatecrash/CryptGhast.java index 69d29454f2..87693e80a7 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/CryptGhast.java +++ b/Mage.Sets/src/mage/sets/gatecrash/CryptGhast.java @@ -29,19 +29,20 @@ package mage.sets.gatecrash; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.Mana; import mage.abilities.effects.common.BasicManaEffect; import mage.abilities.keyword.ExtortAbility; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterControlledLandPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -90,15 +91,15 @@ class CryptGhastTriggeredAbility extends TriggeredManaAbility { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TAPPED_FOR_MANA) { - Permanent land = game.getPermanent(event.getTargetId()); - if (land != null && filter.match(land, this.getSourceId(), this.getControllerId(), game)) { - return true; - } - } - return false; + Permanent land = game.getPermanent(event.getTargetId()); + return land != null && filter.match(land, this.getSourceId(), this.getControllerId(), game); } @Override diff --git a/Mage.Sets/src/mage/sets/gatecrash/DuskmantleGuildmage.java b/Mage.Sets/src/mage/sets/gatecrash/DuskmantleGuildmage.java index 6cfb3ad6b2..c608882f9a 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/DuskmantleGuildmage.java +++ b/Mage.Sets/src/mage/sets/gatecrash/DuskmantleGuildmage.java @@ -28,10 +28,6 @@ package mage.sets.gatecrash; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; @@ -43,6 +39,10 @@ import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -99,19 +99,22 @@ class CardPutIntoOpponentGraveThisTurn extends DelayedTriggeredAbility { return new CardPutIntoOpponentGraveThisTurn(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - UUID cardId = event.getTargetId(); - Card card = game.getCard(cardId); - if (card != null && zEvent.getToZone() == Zone.GRAVEYARD && !card.isCopy() - && game.getOpponents(controllerId).contains(card.getOwnerId())) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(card.getOwnerId())); - } - return true; + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + UUID cardId = event.getTargetId(); + Card card = game.getCard(cardId); + if (card != null && zEvent.getToZone() == Zone.GRAVEYARD && !card.isCopy() + && game.getOpponents(controllerId).contains(card.getOwnerId())) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(card.getOwnerId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/gatecrash/FathomMage.java b/Mage.Sets/src/mage/sets/gatecrash/FathomMage.java index 2a399e5538..67f67d0d83 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/FathomMage.java +++ b/Mage.Sets/src/mage/sets/gatecrash/FathomMage.java @@ -29,18 +29,18 @@ package mage.sets.gatecrash; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.keyword.EvolveAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -86,14 +86,14 @@ class FathomMageTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.COUNTER_ADDED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.COUNTER_ADDED) { - if (event.getTargetId().equals(this.getSourceId()) && event.getData().equals(CounterType.P1P1.getName())) { - return true; - } - } - return false; + return event.getTargetId().equals(this.getSourceId()) && event.getData().equals(CounterType.P1P1.getName()); } @Override diff --git a/Mage.Sets/src/mage/sets/gatecrash/FiveAlarmFire.java b/Mage.Sets/src/mage/sets/gatecrash/FiveAlarmFire.java index 1d18de1d7d..cfb6dce7dc 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/FiveAlarmFire.java +++ b/Mage.Sets/src/mage/sets/gatecrash/FiveAlarmFire.java @@ -101,23 +101,29 @@ class FiveAlarmFireTriggeredAbility extends TriggeredAbilityImpl { return new FiveAlarmFireTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE + || event.getType() == EventType.DAMAGED_PLANESWALKER + || event.getType() == EventType.DAMAGED_PLAYER + || event.getType() == EventType.COMBAT_DAMAGE_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE - || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER - || event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { + if (event.getType() == EventType.DAMAGED_CREATURE + || event.getType() == EventType.DAMAGED_PLANESWALKER + || event.getType() == EventType.DAMAGED_PLAYER) { if (((DamagedEvent) event).isCombatDamage() && !triggeringCreatures.contains(event.getSourceId())) { Permanent permanent = game.getPermanent(event.getSourceId()); if (permanent != null && filter.match(permanent, sourceId, controllerId, game)) { triggeringCreatures.add(event.getSourceId()); return true; } - } - } // reset the remembered creatures for every combat damage step - if (event.getType().equals(EventType.COMBAT_DAMAGE_STEP_PRE)) { + if (event.getType() == EventType.COMBAT_DAMAGE_STEP_PRE) { triggeringCreatures.clear(); } return false; diff --git a/Mage.Sets/src/mage/sets/gatecrash/GruulRagebeast.java b/Mage.Sets/src/mage/sets/gatecrash/GruulRagebeast.java index d2e18c0c0d..d1f3b76f5e 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/GruulRagebeast.java +++ b/Mage.Sets/src/mage/sets/gatecrash/GruulRagebeast.java @@ -28,19 +28,23 @@ package mage.sets.gatecrash; import java.util.UUID; - -import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.CardIdPredicate; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; import mage.target.targetpointer.FixedTarget; @@ -100,20 +104,23 @@ class GruulRagebeastTriggeredAbility extends TriggeredAbilityImpl { return new GruulRagebeastTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - UUID targetId = event.getTargetId(); - Permanent permanent = game.getPermanent(targetId); - if (permanent.getControllerId().equals(this.controllerId) - && permanent.getCardType().contains(CardType.CREATURE) - && (targetId.equals(this.getSourceId()) - || !targetId.equals(this.getSourceId()))) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - } - return true; + UUID targetId = event.getTargetId(); + Permanent permanent = game.getPermanent(targetId); + if (permanent.getControllerId().equals(this.controllerId) + && permanent.getCardType().contains(CardType.CREATURE) + && (targetId.equals(this.getSourceId()) + || !targetId.equals(this.getSourceId()))) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/gatecrash/HighPriestOfPenance.java b/Mage.Sets/src/mage/sets/gatecrash/HighPriestOfPenance.java index 40afe2cf98..1c2196d126 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/HighPriestOfPenance.java +++ b/Mage.Sets/src/mage/sets/gatecrash/HighPriestOfPenance.java @@ -29,16 +29,16 @@ package mage.sets.gatecrash; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetNonlandPermanent; /** @@ -88,14 +88,14 @@ class HighPriestOfPenanceTriggeredAbility extends TriggeredAbilityImpl { return new HighPriestOfPenanceTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) { - if (event.getTargetId().equals(this.sourceId)) { - return true; - } - } - return false; + return event.getTargetId().equals(this.sourceId); } @Override diff --git a/Mage.Sets/src/mage/sets/gatecrash/IllusionistsBracers.java b/Mage.Sets/src/mage/sets/gatecrash/IllusionistsBracers.java index ff3acf0236..83a86cc47b 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/IllusionistsBracers.java +++ b/Mage.Sets/src/mage/sets/gatecrash/IllusionistsBracers.java @@ -28,10 +28,6 @@ package mage.sets.gatecrash; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.GenericManaCost; @@ -40,8 +36,13 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.EquipAbility; import mage.abilities.mana.ManaAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.stack.StackAbility; import mage.players.Player; @@ -88,17 +89,20 @@ class AbilityActivatedTriggeredAbility extends TriggeredAbilityImpl { return new AbilityActivatedTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ACTIVATED_ABILITY; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ACTIVATED_ABILITY) { - Permanent equipment = game.getPermanent(this.getSourceId()); - if (equipment != null && equipment.getAttachedTo() != null && equipment.getAttachedTo().equals(event.getSourceId())) { - StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId()); - if (!(stackAbility.getStackAbility() instanceof ManaAbility)) { - Effect effect = this.getEffects().get(0); - effect.setValue("stackAbility", stackAbility.getStackAbility()); - return true; - } + Permanent equipment = game.getPermanent(this.getSourceId()); + if (equipment != null && equipment.getAttachedTo() != null && equipment.getAttachedTo().equals(event.getSourceId())) { + StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId()); + if (!(stackAbility.getStackAbility() instanceof ManaAbility)) { + Effect effect = this.getEffects().get(0); + effect.setValue("stackAbility", stackAbility.getStackAbility()); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/gatecrash/IncursionSpecialist.java b/Mage.Sets/src/mage/sets/gatecrash/IncursionSpecialist.java index ffbdfecb93..915acc973a 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/IncursionSpecialist.java +++ b/Mage.Sets/src/mage/sets/gatecrash/IncursionSpecialist.java @@ -28,15 +28,19 @@ package mage.sets.gatecrash; import java.util.UUID; - -import mage.constants.*; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.WatcherScope; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.watchers.Watcher; @@ -85,9 +89,14 @@ class IncursionTriggeredAbility extends TriggeredAbilityImpl { return new IncursionTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(controllerId)) { + if (event.getPlayerId().equals(controllerId)) { Watcher watcher = game.getState().getWatchers().get("SecondSpellCast", controllerId); if (watcher != null && watcher.conditionMet()) { return true; diff --git a/Mage.Sets/src/mage/sets/gatecrash/LeylinePhantom.java b/Mage.Sets/src/mage/sets/gatecrash/LeylinePhantom.java index 7738e497bc..211072dca8 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/LeylinePhantom.java +++ b/Mage.Sets/src/mage/sets/gatecrash/LeylinePhantom.java @@ -29,17 +29,17 @@ package mage.sets.gatecrash; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.ReturnToHandSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -73,7 +73,6 @@ public class LeylinePhantom extends CardImpl { class LeylinePhantomTriggeredAbility extends TriggeredAbilityImpl { - public LeylinePhantomTriggeredAbility() { super(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true), false); } @@ -87,14 +86,14 @@ class LeylinePhantomTriggeredAbility extends TriggeredAbilityImpl { return new LeylinePhantomTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE || event.getType() == EventType.DAMAGED_PLANESWALKER || event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER || event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { - if(((DamagedEvent) event).isCombatDamage() && event.getSourceId().equals(this.getSourceId())){ - return true; - } - } - return false; + return ((DamagedEvent) event).isCombatDamage() && event.getSourceId().equals(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/gatecrash/ObzedatGhostCouncil.java b/Mage.Sets/src/mage/sets/gatecrash/ObzedatGhostCouncil.java index 1e15e29751..8de83fd6c9 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/ObzedatGhostCouncil.java +++ b/Mage.Sets/src/mage/sets/gatecrash/ObzedatGhostCouncil.java @@ -29,9 +29,6 @@ package mage.sets.gatecrash; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; @@ -46,13 +43,16 @@ import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; import mage.abilities.keyword.HasteAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.TargetController; import mage.constants.Zone; import mage.game.ExileZone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetOpponent; @@ -138,9 +138,14 @@ class BeginningOfYourUpkeepdelayTriggeredAbility extends DelayedTriggeredAbility super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId); + return event.getPlayerId().equals(this.controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/gatecrash/RustScarab.java b/Mage.Sets/src/mage/sets/gatecrash/RustScarab.java index 1d29e0ce3a..02819caf9d 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/RustScarab.java +++ b/Mage.Sets/src/mage/sets/gatecrash/RustScarab.java @@ -28,15 +28,13 @@ package mage.sets.gatecrash; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; @@ -44,6 +42,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.Target; import mage.target.TargetPermanent; @@ -89,9 +88,14 @@ class BecomesBlockedTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.CREATURE_BLOCKED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.CREATURE_BLOCKED && event.getTargetId().equals(this.getSourceId())) { + if (event.getTargetId().equals(this.getSourceId())) { UUID defenderId = game.getState().getCombat().findGroup(this.getSourceId()).getDefenderId(); if (defenderId != null) { this.getTargets().clear(); diff --git a/Mage.Sets/src/mage/sets/gatecrash/VerdantHaven.java b/Mage.Sets/src/mage/sets/gatecrash/VerdantHaven.java index d0abdaa242..f53b501b94 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/VerdantHaven.java +++ b/Mage.Sets/src/mage/sets/gatecrash/VerdantHaven.java @@ -42,6 +42,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; @@ -98,14 +99,14 @@ class VerdantHavenTriggeredAbility extends TriggeredManaAbility { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if(event.getType() == GameEvent.EventType.TAPPED_FOR_MANA){ - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - return true; - } - } - return false; + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent enchantment = game.getPermanent(this.getSourceId()); + return enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo()); } diff --git a/Mage.Sets/src/mage/sets/gatecrash/VizkopaGuildmage.java b/Mage.Sets/src/mage/sets/gatecrash/VizkopaGuildmage.java index cf9b249967..04b112d2ef 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/VizkopaGuildmage.java +++ b/Mage.Sets/src/mage/sets/gatecrash/VizkopaGuildmage.java @@ -29,12 +29,6 @@ package mage.sets.gatecrash; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; @@ -45,8 +39,14 @@ import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.LifelinkAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.common.TargetCreaturePermanent; @@ -106,10 +106,15 @@ class VizkopaGuildmageDelayedTriggeredAbility extends DelayedTriggeredAbility { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.GAINED_LIFE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.GAINED_LIFE && event.getTargetId().equals(controllerId)) { - getEffects().get(0).setValue("amountLifeGained", new Integer(event.getAmount())); + if (event.getTargetId().equals(controllerId)) { + getEffects().get(0).setValue("amountLifeGained", event.getAmount()); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/guildpact/BurningTreeShaman.java b/Mage.Sets/src/mage/sets/guildpact/BurningTreeShaman.java index 6147d04f37..dded38dbd8 100644 --- a/Mage.Sets/src/mage/sets/guildpact/BurningTreeShaman.java +++ b/Mage.Sets/src/mage/sets/guildpact/BurningTreeShaman.java @@ -29,17 +29,17 @@ package mage.sets.guildpact; import java.util.UUID; - -import mage.constants.AbilityType; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; +import mage.constants.AbilityType; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.StackAbility; import mage.target.TargetPlayer; @@ -86,14 +86,17 @@ class BurningTreeShamanTriggeredAbility extends TriggeredAbilityImpl { return new BurningTreeShamanTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ACTIVATED_ABILITY; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ACTIVATED_ABILITY) { - StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId()); - if (stackAbility.getAbilityType() == AbilityType.ACTIVATED) { - this.getTargets().get(0).add(event.getPlayerId(), game); - return true; - } + StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId()); + if (stackAbility.getAbilityType() == AbilityType.ACTIVATED) { + this.getTargets().get(0).add(event.getPlayerId(), game); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/guildpact/InkTreaderNephilim.java b/Mage.Sets/src/mage/sets/guildpact/InkTreaderNephilim.java index bba04f81da..00dfc684c6 100644 --- a/Mage.Sets/src/mage/sets/guildpact/InkTreaderNephilim.java +++ b/Mage.Sets/src/mage/sets/guildpact/InkTreaderNephilim.java @@ -28,21 +28,22 @@ package mage.sets.guildpact; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; -import mage.cards.CardImpl; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; -import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.stack.Spell; import mage.abilities.effects.common.CopySpellForEachItCouldTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterInPlay; import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; +import mage.game.stack.Spell; import mage.target.Target; import mage.util.TargetAddress; @@ -88,17 +89,20 @@ class InkTreaderNephilimTriggeredAbility extends TriggeredAbilityImpl { return new InkTreaderNephilimTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && - (spell.getCardType().contains(CardType.INSTANT) || spell.getCardType().contains(CardType.SORCERY))){ - for (Effect effect : getEffects()) { - effect.setValue("triggeringSpell", spell); - } - return true; + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null && + (spell.getCardType().contains(CardType.INSTANT) || spell.getCardType().contains(CardType.SORCERY))){ + for (Effect effect : getEffects()) { + effect.setValue("triggeringSpell", spell); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/guildpact/SoulsOfTheFaultless.java b/Mage.Sets/src/mage/sets/guildpact/SoulsOfTheFaultless.java index 6cd66ece7e..ca4f72da4e 100644 --- a/Mage.Sets/src/mage/sets/guildpact/SoulsOfTheFaultless.java +++ b/Mage.Sets/src/mage/sets/guildpact/SoulsOfTheFaultless.java @@ -42,6 +42,7 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedCreatureEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; @@ -90,10 +91,14 @@ class SoulsOfTheFaultlessTriggeredAbility extends TriggeredAbilityImpl { return new SoulsOfTheFaultlessTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE - && event.getTargetId().equals(this.sourceId) + if (event.getTargetId().equals(this.sourceId) && ((DamagedCreatureEvent) event).isCombatDamage()) { Permanent source = game.getPermanent(event.getSourceId()); if (source == null) { diff --git a/Mage.Sets/src/mage/sets/heroesvsmonsters/DeusOfCalamity.java b/Mage.Sets/src/mage/sets/heroesvsmonsters/DeusOfCalamity.java index 1e344e0981..d81bd55dca 100644 --- a/Mage.Sets/src/mage/sets/heroesvsmonsters/DeusOfCalamity.java +++ b/Mage.Sets/src/mage/sets/heroesvsmonsters/DeusOfCalamity.java @@ -90,10 +90,14 @@ class DeusOfCalamityTriggeredAbility extends TriggeredAbilityImpl { return new DeusOfCalamityTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(EventType.DAMAGED_PLAYER) - && event.getSourceId().equals(this.getSourceId()) + if (event.getSourceId().equals(this.getSourceId()) && event.getAmount() > 5 && game.getOpponents(this.getControllerId()).contains(event.getTargetId())) { FilterLandPermanent filter = new FilterLandPermanent("land of the damaged player"); diff --git a/Mage.Sets/src/mage/sets/heroesvsmonsters/KavuPredator.java b/Mage.Sets/src/mage/sets/heroesvsmonsters/KavuPredator.java index 64654ecfdc..853103d47a 100644 --- a/Mage.Sets/src/mage/sets/heroesvsmonsters/KavuPredator.java +++ b/Mage.Sets/src/mage/sets/heroesvsmonsters/KavuPredator.java @@ -41,6 +41,7 @@ import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; @@ -89,9 +90,14 @@ class KavuPredatorTriggeredAbility extends TriggeredAbilityImpl { return new KavuPredatorTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.GAINED_LIFE; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(GameEvent.EventType.GAINED_LIFE) && game.getOpponents(this.controllerId).contains(event.getPlayerId())) { + if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) { this.getEffects().get(0).setValue("gainedLife", new Integer(event.getAmount())); return true; } diff --git a/Mage.Sets/src/mage/sets/iceage/MagusOfTheUnseen.java b/Mage.Sets/src/mage/sets/iceage/MagusOfTheUnseen.java index a0de5638da..9354f14178 100644 --- a/Mage.Sets/src/mage/sets/iceage/MagusOfTheUnseen.java +++ b/Mage.Sets/src/mage/sets/iceage/MagusOfTheUnseen.java @@ -108,10 +108,14 @@ class MagusOfTheUnseenDelayedTriggeredAbility extends DelayedTriggeredAbility { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.LOST_CONTROL; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return EventType.LOST_CONTROL.equals(event.getType()) - && event.getPlayerId().equals(controllerId) + return event.getPlayerId().equals(controllerId) && event.getSourceId().equals(this.getEffects().get(0).getTargetPointer().getFirst(game, this)); } diff --git a/Mage.Sets/src/mage/sets/iceage/Necropotence.java b/Mage.Sets/src/mage/sets/iceage/Necropotence.java index 0d5516191b..60044a1b7b 100644 --- a/Mage.Sets/src/mage/sets/iceage/Necropotence.java +++ b/Mage.Sets/src/mage/sets/iceage/Necropotence.java @@ -49,6 +49,7 @@ import mage.constants.TargetController; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -97,9 +98,14 @@ class NecropotenceTriggeredAbility extends TriggeredAbilityImpl { return new NecropotenceTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DISCARDED_CARD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (GameEvent.EventType.DISCARDED_CARD.equals(event.getType()) && getControllerId().equals(event.getPlayerId())) { + if (getControllerId().equals(event.getPlayerId())) { this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId())); return true; } diff --git a/Mage.Sets/src/mage/sets/iceage/RayOfCommand.java b/Mage.Sets/src/mage/sets/iceage/RayOfCommand.java index 9a84518e77..b94dc0b793 100644 --- a/Mage.Sets/src/mage/sets/iceage/RayOfCommand.java +++ b/Mage.Sets/src/mage/sets/iceage/RayOfCommand.java @@ -44,6 +44,7 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCreaturePermanent; /** @@ -91,11 +92,17 @@ class RayOfCommandDelayedTriggeredAbility extends DelayedTriggeredAbility { RayOfCommandDelayedTriggeredAbility(RayOfCommandDelayedTriggeredAbility ability) { super(ability); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.LOST_CONTROL; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - return GameEvent.EventType.LOST_CONTROL.equals(event.getType()) && event.getPlayerId().equals(controllerId); + return event.getPlayerId().equals(controllerId); } + @Override public RayOfCommandDelayedTriggeredAbility copy() { return new RayOfCommandDelayedTriggeredAbility(this); diff --git a/Mage.Sets/src/mage/sets/iceage/WildGrowth.java b/Mage.Sets/src/mage/sets/iceage/WildGrowth.java index 513e4568d0..b7fa06e004 100644 --- a/Mage.Sets/src/mage/sets/iceage/WildGrowth.java +++ b/Mage.Sets/src/mage/sets/iceage/WildGrowth.java @@ -28,9 +28,6 @@ package mage.sets.iceage; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.Mana; import mage.abilities.Ability; import mage.abilities.effects.Effect; @@ -39,11 +36,14 @@ import mage.abilities.effects.common.AttachEffect; import mage.abilities.keyword.EnchantAbility; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.ColoredManaSymbol; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; @@ -98,19 +98,22 @@ class WildGrowthTriggeredAbility extends TriggeredManaAbility { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if(event.getType() == GameEvent.EventType.TAPPED_FOR_MANA){ - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - Permanent permanent = game.getPermanent(event.getSourceId()); - if (permanent != null) { - for(Effect effect : getEffects()) { - effect.setTargetPointer(new FixedTarget(permanent.getControllerId())); - } - return true; + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent enchantment = game.getPermanent(this.getSourceId()); + if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { + Permanent permanent = game.getPermanent(event.getSourceId()); + if (permanent != null) { + for(Effect effect : getEffects()) { + effect.setTargetPointer(new FixedTarget(permanent.getControllerId())); } + return true; } - } + } return false; } diff --git a/Mage.Sets/src/mage/sets/innistrad/BurningVengeance.java b/Mage.Sets/src/mage/sets/innistrad/BurningVengeance.java index 917a07f35a..a417a498a9 100644 --- a/Mage.Sets/src/mage/sets/innistrad/BurningVengeance.java +++ b/Mage.Sets/src/mage/sets/innistrad/BurningVengeance.java @@ -27,18 +27,18 @@ */ package mage.sets.innistrad; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCreatureOrPlayer; -import java.util.UUID; - /** * @author nantuko */ @@ -77,14 +77,14 @@ class BurningVengeanceOnCastAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST - && event.getPlayerId().equals(controllerId) - && event.getZone().equals(Zone.GRAVEYARD)) { - return true; - } - return false; + return event.getPlayerId().equals(controllerId) && event.getZone().equals(Zone.GRAVEYARD); } @Override diff --git a/Mage.Sets/src/mage/sets/innistrad/CreepyDoll.java b/Mage.Sets/src/mage/sets/innistrad/CreepyDoll.java index 903130ea3d..9d64dbcd5e 100644 --- a/Mage.Sets/src/mage/sets/innistrad/CreepyDoll.java +++ b/Mage.Sets/src/mage/sets/innistrad/CreepyDoll.java @@ -26,25 +26,25 @@ * or implied, of BetaSteward_at_googlemail.com. */ package mage.sets.innistrad; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.IndestructibleAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedCreatureEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.targetpointer.FixedTarget; -import java.util.UUID; - /** * @author nantuko */ @@ -90,13 +90,16 @@ class CreepyDollTriggeredAbility extends TriggeredAbilityImpl { return new CreepyDollTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedCreatureEvent) { - if (((DamagedCreatureEvent) event).isCombatDamage() && event.getSourceId().equals(sourceId)) { - getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId())); - return true; - } + if (((DamagedCreatureEvent) event).isCombatDamage() && event.getSourceId().equals(sourceId)) { + getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/innistrad/Curiosity.java b/Mage.Sets/src/mage/sets/innistrad/Curiosity.java index 80226a7f55..1293fda005 100644 --- a/Mage.Sets/src/mage/sets/innistrad/Curiosity.java +++ b/Mage.Sets/src/mage/sets/innistrad/Curiosity.java @@ -27,25 +27,24 @@ */ package mage.sets.innistrad; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; -import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; -import java.util.UUID; - /** * * @author Alvin, noxx @@ -95,15 +94,15 @@ class CuriosityAbility extends TriggeredAbilityImpl { return new CuriosityAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - Permanent permanent = game.getPermanent(event.getSourceId()); - if (permanent != null && game.getOpponents(this.controllerId).contains(event.getTargetId()) && permanent.getAttachments().contains(this.getSourceId())) { - return true; - } - } - return false; + Permanent permanent = game.getPermanent(event.getSourceId()); + return permanent != null && game.getOpponents(this.controllerId).contains(event.getTargetId()) && permanent.getAttachments().contains(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/innistrad/CurseOfOblivion.java b/Mage.Sets/src/mage/sets/innistrad/CurseOfOblivion.java index 5c73674464..19c77d5c77 100644 --- a/Mage.Sets/src/mage/sets/innistrad/CurseOfOblivion.java +++ b/Mage.Sets/src/mage/sets/innistrad/CurseOfOblivion.java @@ -28,17 +28,16 @@ package mage.sets.innistrad; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.ExileFromZoneTargetEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.game.Game; import mage.game.events.GameEvent; @@ -97,16 +96,19 @@ class CurseOfOblivionAbility extends TriggeredAbilityImpl { return new CurseOfOblivionAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.UPKEEP_STEP_PRE) { - Permanent enchantment = game.getPermanent(this.sourceId); - if (enchantment != null && enchantment.getAttachedTo() != null) { - Player player = game.getPlayer(enchantment.getAttachedTo()); - if (player != null && game.getActivePlayerId().equals(player.getId())) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId())); - return true; - } + Permanent enchantment = game.getPermanent(this.sourceId); + if (enchantment != null && enchantment.getAttachedTo() != null) { + Player player = game.getPlayer(enchantment.getAttachedTo()); + if (player != null && game.getActivePlayerId().equals(player.getId())) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId())); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/innistrad/CurseOfStalkedPrey.java b/Mage.Sets/src/mage/sets/innistrad/CurseOfStalkedPrey.java index 898e050447..0803298ad6 100644 --- a/Mage.Sets/src/mage/sets/innistrad/CurseOfStalkedPrey.java +++ b/Mage.Sets/src/mage/sets/innistrad/CurseOfStalkedPrey.java @@ -28,17 +28,16 @@ package mage.sets.innistrad; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; @@ -99,9 +98,14 @@ class CurseOfStalkedPreyTriggeredAbility extends TriggeredAbilityImpl { return new CurseOfStalkedPreyTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_PLAYER && ((DamagedPlayerEvent) event).isCombatDamage()) { + if (((DamagedPlayerEvent) event).isCombatDamage()) { Permanent enchantment = game.getPermanent(this.sourceId); if (enchantment != null && enchantment.getAttachedTo() != null) { Player player = game.getPlayer(enchantment.getAttachedTo()); diff --git a/Mage.Sets/src/mage/sets/innistrad/CurseOfTheBloodyTome.java b/Mage.Sets/src/mage/sets/innistrad/CurseOfTheBloodyTome.java index 57821a1edd..e50bce3c6c 100644 --- a/Mage.Sets/src/mage/sets/innistrad/CurseOfTheBloodyTome.java +++ b/Mage.Sets/src/mage/sets/innistrad/CurseOfTheBloodyTome.java @@ -28,16 +28,16 @@ package mage.sets.innistrad; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -95,16 +95,19 @@ class CurseOfTheBloodyTomeAbility extends TriggeredAbilityImpl { return new CurseOfTheBloodyTomeAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.UPKEEP_STEP_PRE) { - Permanent enchantment = game.getPermanent(this.sourceId); - if (enchantment != null && enchantment.getAttachedTo() != null) { - Player player = game.getPlayer(enchantment.getAttachedTo()); - if (player != null && game.getActivePlayerId().equals(player.getId())) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId())); - return true; - } + Permanent enchantment = game.getPermanent(this.sourceId); + if (enchantment != null && enchantment.getAttachedTo() != null) { + Player player = game.getPlayer(enchantment.getAttachedTo()); + if (player != null && game.getActivePlayerId().equals(player.getId())) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId())); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/innistrad/CurseOfThePiercedHeart.java b/Mage.Sets/src/mage/sets/innistrad/CurseOfThePiercedHeart.java index b0cc02e2dd..35193e3cdf 100644 --- a/Mage.Sets/src/mage/sets/innistrad/CurseOfThePiercedHeart.java +++ b/Mage.Sets/src/mage/sets/innistrad/CurseOfThePiercedHeart.java @@ -28,17 +28,16 @@ package mage.sets.innistrad; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -96,16 +95,19 @@ class CurseOfThePiercedHeartAbility extends TriggeredAbilityImpl { return new CurseOfThePiercedHeartAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DRAW_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DRAW_STEP_PRE) { - Permanent enchantment = game.getPermanent(this.sourceId); - if (enchantment != null && enchantment.getAttachedTo() != null) { - Player player = game.getPlayer(enchantment.getAttachedTo()); - if (player != null && game.getActivePlayerId().equals(player.getId())) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId())); - return true; - } + Permanent enchantment = game.getPermanent(this.sourceId); + if (enchantment != null && enchantment.getAttachedTo() != null) { + Player player = game.getPlayer(enchantment.getAttachedTo()); + if (player != null && game.getActivePlayerId().equals(player.getId())) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId())); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/innistrad/FalkenrathNoble.java b/Mage.Sets/src/mage/sets/innistrad/FalkenrathNoble.java index 8e8e1bbf7e..ce8a5d39fd 100644 --- a/Mage.Sets/src/mage/sets/innistrad/FalkenrathNoble.java +++ b/Mage.Sets/src/mage/sets/innistrad/FalkenrathNoble.java @@ -28,17 +28,18 @@ package mage.sets.innistrad; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.target.TargetPlayer; @@ -89,19 +90,22 @@ class FalkenrathNobleTriggeredAbility extends TriggeredAbilityImpl { return new FalkenrathNobleTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { - Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (permanent != null) { - if (permanent.getId().equals(this.getSourceId())) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { + Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + if (permanent != null) { + if (permanent.getId().equals(this.getSourceId())) { + return true; + } else { + if (permanent.getCardType().contains(CardType.CREATURE)) { return true; - } else { - if (permanent.getCardType().contains(CardType.CREATURE)) { - return true; - } } } } diff --git a/Mage.Sets/src/mage/sets/innistrad/GarrukRelentless.java b/Mage.Sets/src/mage/sets/innistrad/GarrukRelentless.java index 2bc737f28f..3d3e258a14 100644 --- a/Mage.Sets/src/mage/sets/innistrad/GarrukRelentless.java +++ b/Mage.Sets/src/mage/sets/innistrad/GarrukRelentless.java @@ -27,8 +27,7 @@ */ package mage.sets.innistrad; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.TriggeredAbilityImpl; @@ -39,17 +38,18 @@ import mage.abilities.effects.common.TransformSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.TransformAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.permanent.token.WolfToken; import mage.target.common.TargetCreaturePermanent; -import java.util.UUID; - /** * @author nantuko */ @@ -105,9 +105,14 @@ class GarrukRelentlessTriggeredAbility extends TriggeredAbilityImpl { return new GarrukRelentlessTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLANESWALKER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER && event.getTargetId().equals(sourceId)) { + if (event.getTargetId().equals(sourceId)) { Permanent permanent = game.getPermanent(sourceId); if (permanent != null && !permanent.isTransformed() && permanent.getCounters().getCount(CounterType.LOYALTY) <= 2) { return true; diff --git a/Mage.Sets/src/mage/sets/innistrad/GrimgrinCorpseBorn.java b/Mage.Sets/src/mage/sets/innistrad/GrimgrinCorpseBorn.java index db9609e39c..727d038438 100644 --- a/Mage.Sets/src/mage/sets/innistrad/GrimgrinCorpseBorn.java +++ b/Mage.Sets/src/mage/sets/innistrad/GrimgrinCorpseBorn.java @@ -49,6 +49,7 @@ import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetCreaturePermanent; @@ -109,9 +110,14 @@ class GrimgrinCorpseBornAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { + if (event.getSourceId().equals(this.getSourceId())) { FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls"); UUID defenderId = game.getCombat().getDefenderId(sourceId); filter.add(new ControllerIdPredicate(defenderId)); diff --git a/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java b/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java index 59e9efb875..1994869f6a 100644 --- a/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java +++ b/Mage.Sets/src/mage/sets/innistrad/GutterGrime.java @@ -27,6 +27,7 @@ */ package mage.sets.innistrad; +import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -38,7 +39,11 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; @@ -48,8 +53,6 @@ import mage.game.permanent.Permanent; import mage.game.permanent.PermanentToken; import mage.game.permanent.token.Token; -import java.util.UUID; - /** * * @author BetaSteward @@ -91,21 +94,24 @@ class GutterGrimeTriggeredAbility extends TriggeredAbilityImpl { return new GutterGrimeTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE) { - UUID targetId = event.getTargetId(); - MageObject card = game.getLastKnownInformation(targetId, Zone.BATTLEFIELD); - if (card instanceof Permanent && !(card instanceof PermanentToken)) { - Permanent permanent = (Permanent) card; - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD - && permanent.getControllerId().equals(this.controllerId) - && (targetId.equals(this.getSourceId()) - || (permanent.getCardType().contains(CardType.CREATURE) - && !(permanent instanceof PermanentToken)))) { - return true; - } + UUID targetId = event.getTargetId(); + MageObject card = game.getLastKnownInformation(targetId, Zone.BATTLEFIELD); + if (card instanceof Permanent && !(card instanceof PermanentToken)) { + Permanent permanent = (Permanent) card; + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD + && permanent.getControllerId().equals(this.controllerId) + && (targetId.equals(this.getSourceId()) + || (permanent.getCardType().contains(CardType.CREATURE) + && !(permanent instanceof PermanentToken)))) { + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/innistrad/HomicidalBrute.java b/Mage.Sets/src/mage/sets/innistrad/HomicidalBrute.java index 6207edd273..087265e34d 100644 --- a/Mage.Sets/src/mage/sets/innistrad/HomicidalBrute.java +++ b/Mage.Sets/src/mage/sets/innistrad/HomicidalBrute.java @@ -27,18 +27,18 @@ */ package mage.sets.innistrad; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.TapSourceEffect; import mage.abilities.effects.common.TransformSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; - -import java.util.UUID; +import mage.game.events.GameEvent.EventType; import mage.watchers.Watcher; /** @@ -91,9 +91,14 @@ class HomicidalBruteTriggeredAbility extends TriggeredAbilityImpl { return new HomicidalBruteTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { + if (event.getPlayerId().equals(this.controllerId)) { Watcher watcher = game.getState().getWatchers().get("HomicidalBruteAttacked", sourceId); if (watcher == null || !watcher.conditionMet()) { return true; diff --git a/Mage.Sets/src/mage/sets/innistrad/RakishHeir.java b/Mage.Sets/src/mage/sets/innistrad/RakishHeir.java index 8df3ac41ad..1936fd5c49 100644 --- a/Mage.Sets/src/mage/sets/innistrad/RakishHeir.java +++ b/Mage.Sets/src/mage/sets/innistrad/RakishHeir.java @@ -28,17 +28,18 @@ package mage.sets.innistrad; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -85,19 +86,22 @@ class RakishHeirTriggeredAbility extends TriggeredAbilityImpl { return new RakishHeirTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; - Permanent permanent = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && permanent != null - && permanent.hasSubtype("Vampire") && permanent.getControllerId().equals(controllerId)) { - this.getEffects().clear(); - AddCountersTargetEffect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance()); - effect.setTargetPointer(new FixedTarget(permanent.getId())); - this.addEffect(effect); - return true; - } + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + Permanent permanent = game.getPermanent(event.getSourceId()); + if (damageEvent.isCombatDamage() && permanent != null + && permanent.hasSubtype("Vampire") && permanent.getControllerId().equals(controllerId)) { + this.getEffects().clear(); + AddCountersTargetEffect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance()); + effect.setTargetPointer(new FixedTarget(permanent.getId())); + this.addEffect(effect); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/innistrad/ReaperFromTheAbyss.java b/Mage.Sets/src/mage/sets/innistrad/ReaperFromTheAbyss.java index fccc03b9e3..c64bb9f2f0 100644 --- a/Mage.Sets/src/mage/sets/innistrad/ReaperFromTheAbyss.java +++ b/Mage.Sets/src/mage/sets/innistrad/ReaperFromTheAbyss.java @@ -29,21 +29,21 @@ package mage.sets.innistrad; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCreaturePermanent; import mage.watchers.Watcher; @@ -99,13 +99,15 @@ class ReaperFromTheAbyssAbility extends TriggeredAbilityImpl { return new ReaperFromTheAbyssAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE) { - Watcher watcher = game.getState().getWatchers().get("Morbid"); - return watcher.conditionMet(); - } - return false; + Watcher watcher = game.getState().getWatchers().get("Morbid"); + return watcher.conditionMet(); } @Override diff --git a/Mage.Sets/src/mage/sets/innistrad/ScreechingBat.java b/Mage.Sets/src/mage/sets/innistrad/ScreechingBat.java index 7ebc1ee753..5948bfa65c 100644 --- a/Mage.Sets/src/mage/sets/innistrad/ScreechingBat.java +++ b/Mage.Sets/src/mage/sets/innistrad/ScreechingBat.java @@ -27,27 +27,27 @@ */ package mage.sets.innistrad; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.condition.common.TransformedCondition; import mage.abilities.costs.Cost; import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.TransformAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; -import java.util.UUID; -import mage.abilities.condition.common.TransformedCondition; -import mage.abilities.decorator.ConditionalTriggeredAbility; - /** * @author nantuko */ @@ -96,12 +96,14 @@ class ScreechingBatBeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImp return new ScreechingBatBeginningOfUpkeepTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) { - return event.getPlayerId().equals(this.controllerId); - } - return false; + return event.getPlayerId().equals(this.controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/innistrad/ThrabenSentry.java b/Mage.Sets/src/mage/sets/innistrad/ThrabenSentry.java index 4ca0ffb074..a18f74df8d 100644 --- a/Mage.Sets/src/mage/sets/innistrad/ThrabenSentry.java +++ b/Mage.Sets/src/mage/sets/innistrad/ThrabenSentry.java @@ -27,22 +27,22 @@ */ package mage.sets.innistrad; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.TransformSourceEffect; import mage.abilities.keyword.TransformAbility; import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; -import java.util.UUID; - /** * @author nantuko */ @@ -92,27 +92,24 @@ class ThrabenSentryTriggeredAbility extends TriggeredAbilityImpl { return new ThrabenSentryTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - - Permanent source = game.getPermanent(this.sourceId); - if (source == null) { - return false; - } - - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - Permanent permanent = zEvent.getTarget(); - - if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && - zEvent.getToZone() == Zone.GRAVEYARD && - zEvent.getFromZone() == Zone.BATTLEFIELD && - permanent.getControllerId().equals(this.getControllerId()) && - !source.isTransformed()) { - return true; - } + Permanent source = game.getPermanent(this.sourceId); + if (source == null) { + return false; } - return false; + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + Permanent permanent = zEvent.getTarget(); + return permanent != null && permanent.getCardType().contains(CardType.CREATURE) && + zEvent.getToZone() == Zone.GRAVEYARD && + zEvent.getFromZone() == Zone.BATTLEFIELD && + permanent.getControllerId().equals(this.getControllerId()) && + !source.isTransformed(); } @Override diff --git a/Mage.Sets/src/mage/sets/innistrad/VillageCannibals.java b/Mage.Sets/src/mage/sets/innistrad/VillageCannibals.java index e00e0240ad..7a42dde251 100644 --- a/Mage.Sets/src/mage/sets/innistrad/VillageCannibals.java +++ b/Mage.Sets/src/mage/sets/innistrad/VillageCannibals.java @@ -28,16 +28,17 @@ package mage.sets.innistrad; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; @@ -84,16 +85,19 @@ class VillageCannibalsTriggeredAbility extends TriggeredAbilityImpl { return new VillageCannibalsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { - Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && permanent.hasSubtype("Human") - && !permanent.getId().equals(this.getSourceId())) { - return true; - } + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { + Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && permanent.hasSubtype("Human") + && !permanent.getId().equals(this.getSourceId())) { + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/innistrad/WoodenStake.java b/Mage.Sets/src/mage/sets/innistrad/WoodenStake.java index ddc5fe8496..b0d1ceaa68 100644 --- a/Mage.Sets/src/mage/sets/innistrad/WoodenStake.java +++ b/Mage.Sets/src/mage/sets/innistrad/WoodenStake.java @@ -27,8 +27,7 @@ */ package mage.sets.innistrad; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; @@ -37,15 +36,16 @@ import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.continuous.BoostEquippedEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; -import java.util.UUID; - /** * @author nantuko */ @@ -86,31 +86,34 @@ class WoodenStakeBlocksOrBecomesBlockedTriggeredAbility extends TriggeredAbility super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BLOCKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) { - Permanent equipment = game.getPermanent(sourceId); - if (equipment != null && equipment.getAttachedTo() != null) { - if (event.getSourceId().equals(equipment.getAttachedTo())) { - Permanent blocks = game.getPermanent(event.getTargetId()); - if (blocks != null && blocks.hasSubtype("Vampire")) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - } - return true; + Permanent equipment = game.getPermanent(sourceId); + if (equipment != null && equipment.getAttachedTo() != null) { + if (event.getSourceId().equals(equipment.getAttachedTo())) { + Permanent blocks = game.getPermanent(event.getTargetId()); + if (blocks != null && blocks.hasSubtype("Vampire")) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); } - return false; + return true; } - if (event.getTargetId().equals(equipment.getAttachedTo())) { - Permanent blockedBy = game.getPermanent(event.getSourceId()); - if (blockedBy != null && blockedBy.hasSubtype("Vampire")) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getSourceId())); - } - return true; + return false; + } + if (event.getTargetId().equals(equipment.getAttachedTo())) { + Permanent blockedBy = game.getPermanent(event.getSourceId()); + if (blockedBy != null && blockedBy.hasSubtype("Vampire")) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getSourceId())); } - return false; + return true; } + return false; } } return false; diff --git a/Mage.Sets/src/mage/sets/jacevsvraska/AeonChronicler.java b/Mage.Sets/src/mage/sets/jacevsvraska/AeonChronicler.java index f801f9e50c..8ee804a895 100644 --- a/Mage.Sets/src/mage/sets/jacevsvraska/AeonChronicler.java +++ b/Mage.Sets/src/mage/sets/jacevsvraska/AeonChronicler.java @@ -95,9 +95,14 @@ class AeonChroniclerTriggeredAbility extends TriggeredAbilityImpl { return new AeonChroniclerTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.COUNTER_REMOVED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return EventType.COUNTER_REMOVED.equals(event.getType()) && event.getData().equals(CounterType.TIME.getName()) && event.getTargetId().equals(this.getSourceId()); + return event.getData().equals(CounterType.TIME.getName()) && event.getTargetId().equals(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/AthreosGodOfPassage.java b/Mage.Sets/src/mage/sets/journeyintonyx/AthreosGodOfPassage.java index 59c9e325d8..412b1ecaad 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/AthreosGodOfPassage.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/AthreosGodOfPassage.java @@ -51,6 +51,7 @@ import mage.filter.predicate.other.OwnerPredicate; import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -166,18 +167,21 @@ class AthreosDiesCreatureTriggeredAbility extends TriggeredAbilityImpl { return new AthreosDiesCreatureTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(GameEvent.EventType.ZONE_CHANGE)) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getFromZone().equals(Zone.BATTLEFIELD) && zEvent.getToZone().equals(Zone.GRAVEYARD)) { - Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (permanent != null && filter.match(permanent, sourceId, controllerId, game)) { - for (Effect effect : this.getEffects()) { - effect.setValue("creatureId", event.getTargetId()); - } - return true; + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone().equals(Zone.BATTLEFIELD) && zEvent.getToZone().equals(Zone.GRAVEYARD)) { + Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + if (permanent != null && filter.match(permanent, sourceId, controllerId, game)) { + for (Effect effect : this.getEffects()) { + effect.setValue("creatureId", event.getTargetId()); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/BloodcrazedHoplite.java b/Mage.Sets/src/mage/sets/journeyintonyx/BloodcrazedHoplite.java index f7cf747031..c5b745b589 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/BloodcrazedHoplite.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/BloodcrazedHoplite.java @@ -44,6 +44,7 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCreaturePermanent; /** @@ -95,14 +96,14 @@ class BloodcrazedHopliteTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.COUNTER_ADDED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.COUNTER_ADDED) { - if (event.getTargetId().equals(this.getSourceId()) && event.getData().equals(CounterType.P1P1.getName())) { - return true; - } - } - return false; + return event.getTargetId().equals(this.getSourceId()) && event.getData().equals(CounterType.P1P1.getName()); } @Override diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/DictateOfKruphix.java b/Mage.Sets/src/mage/sets/journeyintonyx/DictateOfKruphix.java index ccbaf68171..8918170eb3 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/DictateOfKruphix.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/DictateOfKruphix.java @@ -37,6 +37,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -81,13 +82,15 @@ class DictateOfKruphixAbility extends TriggeredAbilityImpl { return new DictateOfKruphixAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DRAW_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DRAW_STEP_PRE) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); - return true; - } - return false; + this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/EidolonOfTheGreatRevel.java b/Mage.Sets/src/mage/sets/journeyintonyx/EidolonOfTheGreatRevel.java index 988022c3b7..28bfbc5d63 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/EidolonOfTheGreatRevel.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/EidolonOfTheGreatRevel.java @@ -38,6 +38,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.target.targetpointer.FixedTarget; @@ -88,16 +89,19 @@ class EidolonOfTheGreatRevelTriggeredAbility extends TriggeredAbilityImpl { return new EidolonOfTheGreatRevelTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if(event.getType() == GameEvent.EventType.SPELL_CAST){ - Spell spell = game.getStack().getSpell(event.getTargetId()); - if(spell != null && spell.getConvertedManaCost() <= 3){ - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - return true; + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null && spell.getConvertedManaCost() <= 3){ + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/Godsend.java b/Mage.Sets/src/mage/sets/journeyintonyx/Godsend.java index 52aad224e4..bb0f16bed2 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/Godsend.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/Godsend.java @@ -113,47 +113,50 @@ class GodsendTriggeredAbility extends TriggeredAbilityImpl { return new GodsendTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_BLOCKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(GameEvent.EventType.DECLARED_BLOCKERS)) { - Permanent equipment = game.getPermanentOrLKIBattlefield((this.getSourceId())); - if (equipment != null && equipment.getAttachedTo()!= null) { - Permanent equippedPermanent = game.getPermanentOrLKIBattlefield((equipment.getAttachedTo())); - if (equippedPermanent != null) { - possibleTargets.clear(); - String targetName = ""; - if (equippedPermanent.isAttacking()) { - for (CombatGroup group: game.getCombat().getGroups()) { - if (group.getAttackers().contains(equippedPermanent.getId())) { - possibleTargets.addAll(group.getBlockers()); - } + Permanent equipment = game.getPermanentOrLKIBattlefield((this.getSourceId())); + if (equipment != null && equipment.getAttachedTo()!= null) { + Permanent equippedPermanent = game.getPermanentOrLKIBattlefield((equipment.getAttachedTo())); + if (equippedPermanent != null) { + possibleTargets.clear(); + String targetName = ""; + if (equippedPermanent.isAttacking()) { + for (CombatGroup group: game.getCombat().getGroups()) { + if (group.getAttackers().contains(equippedPermanent.getId())) { + possibleTargets.addAll(group.getBlockers()); } - targetName = "a creature blocking attacker "; - } else if (equippedPermanent.getBlocking() > 0) { - for (CombatGroup group: game.getCombat().getGroups()) { - if (group.getBlockers().contains(equippedPermanent.getId())) { - possibleTargets.addAll(group.getAttackers()); - } - } - targetName = "a creature blocked by creature "; - } - if (possibleTargets.size() > 0) { - this.getTargets().clear(); - if (possibleTargets.size() == 1) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(possibleTargets.iterator().next())); - } else { - this.getEffects().get(0).setTargetPointer(new FirstTargetPointer()); - targetName = new StringBuilder(targetName).append("equipped by ").append(equipment.getName()).toString(); - FilterCreaturePermanent filter = new FilterCreaturePermanent(targetName); - List uuidPredicates = new ArrayList<>(); - for (UUID creatureId : possibleTargets) { - uuidPredicates.add(new PermanentIdPredicate(creatureId)); - } - filter.add(Predicates.or(uuidPredicates)); - this.getTargets().add(new TargetCreaturePermanent(filter)); - } - return true; } + targetName = "a creature blocking attacker "; + } else if (equippedPermanent.getBlocking() > 0) { + for (CombatGroup group: game.getCombat().getGroups()) { + if (group.getBlockers().contains(equippedPermanent.getId())) { + possibleTargets.addAll(group.getAttackers()); + } + } + targetName = "a creature blocked by creature "; + } + if (possibleTargets.size() > 0) { + this.getTargets().clear(); + if (possibleTargets.size() == 1) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(possibleTargets.iterator().next())); + } else { + this.getEffects().get(0).setTargetPointer(new FirstTargetPointer()); + targetName = new StringBuilder(targetName).append("equipped by ").append(equipment.getName()).toString(); + FilterCreaturePermanent filter = new FilterCreaturePermanent(targetName); + List uuidPredicates = new ArrayList<>(); + for (UUID creatureId : possibleTargets) { + uuidPredicates.add(new PermanentIdPredicate(creatureId)); + } + filter.add(Predicates.or(uuidPredicates)); + this.getTargets().add(new TargetCreaturePermanent(filter)); + } + return true; } } } diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/KeranosGodOfStorms.java b/Mage.Sets/src/mage/sets/journeyintonyx/KeranosGodOfStorms.java index f94df13e69..fc36df89d6 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/KeranosGodOfStorms.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/KeranosGodOfStorms.java @@ -51,6 +51,7 @@ import mage.constants.WatcherScope; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCreatureOrPlayer; @@ -112,9 +113,14 @@ class KeranosGodOfStormsTriggeredAbility extends TriggeredAbilityImpl { return new KeranosGodOfStormsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DREW_CARD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DREW_CARD && event.getPlayerId().equals(this.getControllerId())) { + if (event.getPlayerId().equals(this.getControllerId())) { if (game.getActivePlayerId().equals(this.getControllerId())) { CardsDrawnDuringTurnWatcher watcher = (CardsDrawnDuringTurnWatcher) game.getState().getWatchers().get("CardsDrawnDuringTurn"); if (watcher != null && watcher.getAmountCardsDrawn(event.getPlayerId()) != 1) { diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/KnowledgeAndPower.java b/Mage.Sets/src/mage/sets/journeyintonyx/KnowledgeAndPower.java index f9869338b5..024239a5aa 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/KnowledgeAndPower.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/KnowledgeAndPower.java @@ -32,12 +32,8 @@ import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DoIfCostPaid; -import mage.abilities.effects.common.continuous.BoostSourceEffect; -import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; -import mage.abilities.keyword.FirstStrikeAbility; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Duration; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; @@ -87,12 +83,14 @@ class ScryTriggeredAbility extends TriggeredAbilityImpl { return new ScryTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SCRY; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(EventType.SCRY) && event.getPlayerId().equals(this.getControllerId())) { - return true; - } - return false; + return event.getPlayerId().equals(this.getControllerId()); } @Override diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/MarketFestival.java b/Mage.Sets/src/mage/sets/journeyintonyx/MarketFestival.java index b1e9946c82..6075982ce4 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/MarketFestival.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/MarketFestival.java @@ -43,6 +43,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; @@ -96,15 +97,15 @@ class MarketFestivalTriggeredAbility extends TriggeredManaAbility { return new MarketFestivalTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if(event.getType() == GameEvent.EventType.TAPPED_FOR_MANA){ - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - return true; - } - } - return false; + Permanent enchantment = game.getPermanent(this.getSourceId()); + return enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo()); } diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/MortalObstinacy.java b/Mage.Sets/src/mage/sets/journeyintonyx/MortalObstinacy.java index 41db761d45..41311f2526 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/MortalObstinacy.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/MortalObstinacy.java @@ -46,6 +46,7 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; @@ -103,16 +104,16 @@ class MortalObstinacyAbility extends TriggeredAbilityImpl { return new MortalObstinacyAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - Permanent damageMakingCreature = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && damageMakingCreature != null && damageMakingCreature.getAttachments().contains(this.getSourceId())) { - return true; - } - } - return false; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + Permanent damageMakingCreature = game.getPermanent(event.getSourceId()); + return damageEvent.isCombatDamage() && damageMakingCreature != null && damageMakingCreature.getAttachments().contains(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/SwarmbornGiant.java b/Mage.Sets/src/mage/sets/journeyintonyx/SwarmbornGiant.java index dd3ca1dd5a..a19131e178 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/SwarmbornGiant.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/SwarmbornGiant.java @@ -46,6 +46,7 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -101,9 +102,14 @@ class SwarmbornGiantTriggeredAbility extends TriggeredAbilityImpl { return new SwarmbornGiantTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(GameEvent.EventType.DAMAGED_PLAYER) && event.getTargetId().equals(this.getControllerId())) { + if (event.getTargetId().equals(this.getControllerId())) { DamagedEvent damagedEvent = (DamagedEvent) event; return damagedEvent.isCombatDamage(); } diff --git a/Mage.Sets/src/mage/sets/legends/Abomination.java b/Mage.Sets/src/mage/sets/legends/Abomination.java index 0c33a7c781..5bf815d95f 100644 --- a/Mage.Sets/src/mage/sets/legends/Abomination.java +++ b/Mage.Sets/src/mage/sets/legends/Abomination.java @@ -28,10 +28,6 @@ package mage.sets.legends; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -40,8 +36,13 @@ import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -89,42 +90,44 @@ class AbominationTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) { - Permanent blocker = game.getPermanent(event.getSourceId()); - Permanent blocked = game.getPermanent(event.getTargetId()); - Permanent abomination = game.getPermanent(sourceId); - if (blocker != null && blocker != abomination - && blocker.getColor(game).isWhite() - && blocked == abomination) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getSourceId())); - return true; - } - } - if (blocker != null && blocker == abomination - && game.getPermanent(event.getTargetId()).getColor(game).isWhite()) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - return true; - } - } - if (blocker != null && blocker != abomination - && blocker.getColor(game).isGreen() - && blocked == abomination) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getSourceId())); - return true; - } - } - if (blocker != null && blocker == abomination - && game.getPermanent(event.getTargetId()).getColor(game).isGreen()) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - return true; - } - } + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BLOCKER_DECLARED; + } + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent blocker = game.getPermanent(event.getSourceId()); + Permanent blocked = game.getPermanent(event.getTargetId()); + Permanent abomination = game.getPermanent(sourceId); + if (blocker != null && blocker != abomination + && blocker.getColor(game).isWhite() + && blocked == abomination) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getSourceId())); + return true; + } + } + if (blocker != null && blocker == abomination + && game.getPermanent(event.getTargetId()).getColor(game).isWhite()) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); + return true; + } + } + if (blocker != null && blocker != abomination + && blocker.getColor(game).isGreen() + && blocked == abomination) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getSourceId())); + return true; + } + } + if (blocker != null && blocker == abomination + && game.getPermanent(event.getTargetId()).getColor(game).isGreen()) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); + return true; + } } return false; } diff --git a/Mage.Sets/src/mage/sets/legions/ToxinSliver.java b/Mage.Sets/src/mage/sets/legions/ToxinSliver.java index b7aa297b0e..be0a4e660a 100644 --- a/Mage.Sets/src/mage/sets/legions/ToxinSliver.java +++ b/Mage.Sets/src/mage/sets/legions/ToxinSliver.java @@ -39,6 +39,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -57,7 +58,7 @@ public class ToxinSliver extends CardImpl { // Whenever a Sliver deals combat damage to a creature, destroy that creature. It can't be regenerated. this.addAbility(new DealsDamageToACreatureTriggeredAbility(new DestroyTargetEffect(true), true, false, true)); - + } public ToxinSliver(final ToxinSliver card) { @@ -71,8 +72,8 @@ public class ToxinSliver extends CardImpl { } class DealsDamageTriggeredAbility extends TriggeredAbilityImpl { - - private boolean setTargetPointer; + + private boolean setTargetPointer; public DealsDamageTriggeredAbility(Effect effect, boolean optional, boolean setTargetPointer) { super(Zone.BATTLEFIELD, effect, optional); @@ -80,35 +81,37 @@ class DealsDamageTriggeredAbility extends TriggeredAbilityImpl { } public DealsDamageTriggeredAbility(final DealsDamageTriggeredAbility ability) { - super(ability); - this.setTargetPointer = ability.setTargetPointer; + super(ability); + this.setTargetPointer = ability.setTargetPointer; } @Override public DealsDamageTriggeredAbility copy() { - return new DealsDamageTriggeredAbility(this); + return new DealsDamageTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) { - if (game.getPermanent(event.getSourceId()).hasSubtype("Sliver")) { - if (setTargetPointer) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(game.getControllerId(event.getTargetId()))); - effect.setValue("damage", event.getAmount()); - } - } - return true; + if (game.getPermanent(event.getSourceId()).hasSubtype("Sliver")) { + if (setTargetPointer) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(game.getControllerId(event.getTargetId()))); + effect.setValue("damage", event.getAmount()); } - + } + return true; } - return false; + return false; } @Override public String getRule() { - return "Whenever a Sliver deals damage to a creature" + super.getRule(); + return "Whenever a Sliver deals damage to a creature" + super.getRule(); } } diff --git a/Mage.Sets/src/mage/sets/legions/WallOfHope.java b/Mage.Sets/src/mage/sets/legions/WallOfHope.java index a589525fcb..5e56e96860 100644 --- a/Mage.Sets/src/mage/sets/legions/WallOfHope.java +++ b/Mage.Sets/src/mage/sets/legions/WallOfHope.java @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; /** @@ -59,7 +60,7 @@ public class WallOfHope extends CardImpl { this.addAbility(DefenderAbility.getInstance()); // Whenever Wall of Hope is dealt damage, you gain that much life. this.addAbility(new WallOfHopeTriggeredAbility()); - + } public WallOfHope(final WallOfHope card) { @@ -87,11 +88,16 @@ class WallOfHopeTriggeredAbility extends TriggeredAbilityImpl { return new WallOfHopeTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId)) { - this.getEffects().get(0).setValue("damageAmount", event.getAmount()); - return true; + if (event.getTargetId().equals(this.sourceId)) { + this.getEffects().get(0).setValue("damageAmount", event.getAmount()); + return true; } return false; } @@ -104,10 +110,10 @@ class WallOfHopeTriggeredAbility extends TriggeredAbilityImpl { class WallOfHopeGainLifeEffect extends OneShotEffect { - public WallOfHopeGainLifeEffect() { - super(Outcome.GainLife); - staticText = "you gain that much life"; - } + public WallOfHopeGainLifeEffect() { + super(Outcome.GainLife); + staticText = "you gain that much life"; + } public WallOfHopeGainLifeEffect(final WallOfHopeGainLifeEffect effect) { super(effect); @@ -127,5 +133,4 @@ class WallOfHopeGainLifeEffect extends OneShotEffect { return true; } - -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/limitedalpha/AnkhOfMishra.java b/Mage.Sets/src/mage/sets/limitedalpha/AnkhOfMishra.java index e96a52d584..b69b7d0f67 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/AnkhOfMishra.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/AnkhOfMishra.java @@ -37,6 +37,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -82,18 +83,21 @@ class AnkhOfMishraAbility extends TriggeredAbilityImpl { return new AnkhOfMishraAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent != null && permanent.getCardType().contains(CardType.LAND)) { - Player player = game.getPlayer(permanent.getControllerId()); - if (player != null) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(player.getId())); - } - return true; + if (permanent != null && permanent.getCardType().contains(CardType.LAND)) { + Player player = game.getPlayer(permanent.getControllerId()); + if (player != null) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(player.getId())); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/limitedalpha/BlackVise.java b/Mage.Sets/src/mage/sets/limitedalpha/BlackVise.java index 26e436ef11..057ebaa541 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/BlackVise.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/BlackVise.java @@ -28,7 +28,6 @@ package mage.sets.limitedalpha; import java.util.UUID; - import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.AsEntersBattlefieldAbility; @@ -40,6 +39,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetOpponent; @@ -121,12 +121,14 @@ class BlackViseTriggeredAbility extends TriggeredAbilityImpl { return new BlackViseTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) { - return event.getPlayerId().equals((UUID) game.getState().getValue(getSourceId().toString() + "_player")); - } - return false; + return event.getPlayerId().equals(game.getState().getValue(getSourceId().toString() + "_player")); } @Override diff --git a/Mage.Sets/src/mage/sets/limitedalpha/Cockatrice.java b/Mage.Sets/src/mage/sets/limitedalpha/Cockatrice.java index 8cefbba278..eb9712905e 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/Cockatrice.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/Cockatrice.java @@ -28,22 +28,23 @@ package mage.sets.limitedalpha; import java.util.UUID; -import mage.constants.Outcome; -import mage.constants.Zone; -import mage.abilities.effects.OneShotEffect; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; -import mage.cards.CardImpl; /** * @@ -90,23 +91,26 @@ class CockatriceTriggeredAbility extends TriggeredAbilityImpl { return new CockatriceTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BLOCKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) { - Permanent blocker = game.getPermanent(event.getSourceId()); - Permanent blocked = game.getPermanent(event.getTargetId()); - Permanent cockatrice = game.getPermanent(sourceId); - if (blocker != null && blocker != cockatrice - && !blocker.getSubtype().contains("Wall") - && blocked == cockatrice) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId())); - return true; - } - if (blocker != null && blocker == cockatrice - && !blocked.getSubtype().contains("Wall")) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(blocked.getId())); - return true; - } + Permanent blocker = game.getPermanent(event.getSourceId()); + Permanent blocked = game.getPermanent(event.getTargetId()); + Permanent cockatrice = game.getPermanent(sourceId); + if (blocker != null && blocker != cockatrice + && !blocker.getSubtype().contains("Wall") + && blocked == cockatrice) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId())); + return true; + } + if (blocker != null && blocker == cockatrice + && !blocked.getSubtype().contains("Wall")) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(blocked.getId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/limitedalpha/CrystalRod.java b/Mage.Sets/src/mage/sets/limitedalpha/CrystalRod.java index 3b0b24aff4..789a1b0800 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/CrystalRod.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/CrystalRod.java @@ -28,7 +28,6 @@ package mage.sets.limitedalpha; import java.util.UUID; - import mage.ObjectColor; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.GenericManaCost; @@ -40,6 +39,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; /** @@ -82,15 +82,15 @@ class CrystalRodAbility extends TriggeredAbilityImpl { return new CrystalRodAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).contains(ObjectColor.BLUE)) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getColor(game).contains(ObjectColor.BLUE); } @Override diff --git a/Mage.Sets/src/mage/sets/limitedalpha/DingusEgg.java b/Mage.Sets/src/mage/sets/limitedalpha/DingusEgg.java index 1198a0bbd9..0c197a4e18 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/DingusEgg.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/DingusEgg.java @@ -28,7 +28,6 @@ package mage.sets.limitedalpha; import java.util.UUID; -import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; @@ -40,7 +39,6 @@ import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; -import mage.target.TargetPlayer; import mage.target.targetpointer.FixedTarget; /** @@ -77,23 +75,24 @@ class DingusEggTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getFromZone() == Zone.BATTLEFIELD - && zEvent.getToZone() == Zone.GRAVEYARD - && zEvent.getTarget().getCardType().contains(CardType.LAND)) { - - if (getTargets().size() == 0) { - UUID targetId = zEvent.getTarget().getControllerId(); - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(targetId)); - } + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone() == Zone.BATTLEFIELD + && zEvent.getToZone() == Zone.GRAVEYARD + && zEvent.getTarget().getCardType().contains(CardType.LAND)) { + if (getTargets().size() == 0) { + UUID targetId = zEvent.getTarget().getControllerId(); + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(targetId)); } - return true; - } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/limitedalpha/Fastbond.java b/Mage.Sets/src/mage/sets/limitedalpha/Fastbond.java index d220484fc1..3be02bbc3d 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/Fastbond.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/Fastbond.java @@ -39,6 +39,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; /** @@ -72,8 +73,6 @@ public class Fastbond extends CardImpl { class PlayALandTriggeredAbility extends TriggeredAbilityImpl { - - public PlayALandTriggeredAbility() { super(Zone.BATTLEFIELD, new DamageControllerEffect(1), false); } @@ -82,19 +81,21 @@ class PlayALandTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.LAND_PLAYED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.LAND_PLAYED && event.getPlayerId() == this.getControllerId()) { - return true; - } - return false; + return event.getPlayerId() == this.getControllerId(); } @Override public boolean checkInterveningIfClause(Game game) { Player player = game.getPlayer(this.getControllerId()); - if(player != null){ - if(player.getLandsPlayed() != 1){ + if (player != null){ + if (player.getLandsPlayed() != 1){ return true; } } diff --git a/Mage.Sets/src/mage/sets/limitedalpha/IronStar.java b/Mage.Sets/src/mage/sets/limitedalpha/IronStar.java index 0ff69ced1f..37be1119c4 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/IronStar.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/IronStar.java @@ -28,7 +28,6 @@ package mage.sets.limitedalpha; import java.util.UUID; - import mage.ObjectColor; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.GenericManaCost; @@ -40,6 +39,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; /** @@ -82,15 +82,15 @@ class IronStarAbility extends TriggeredAbilityImpl { return new IronStarAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).contains(ObjectColor.RED)) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getColor(game).contains(ObjectColor.RED); } @Override diff --git a/Mage.Sets/src/mage/sets/limitedalpha/IvoryCup.java b/Mage.Sets/src/mage/sets/limitedalpha/IvoryCup.java index cfde122dc8..e94d96eb1e 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/IvoryCup.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/IvoryCup.java @@ -28,7 +28,6 @@ package mage.sets.limitedalpha; import java.util.UUID; - import mage.ObjectColor; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.GenericManaCost; @@ -40,6 +39,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; /** @@ -81,15 +81,15 @@ class IvoryCupAbility extends TriggeredAbilityImpl { return new IvoryCupAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).contains(ObjectColor.WHITE)) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getColor(game).contains(ObjectColor.WHITE); } @Override diff --git a/Mage.Sets/src/mage/sets/limitedalpha/PsychicVenom.java b/Mage.Sets/src/mage/sets/limitedalpha/PsychicVenom.java index 1071952555..20f2a5d9b9 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/PsychicVenom.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/PsychicVenom.java @@ -41,6 +41,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; @@ -89,18 +90,20 @@ class PsychicVenomAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TAPPED) { - Permanent source = game.getPermanent(this.sourceId); - if (source != null && source.getAttachedTo().equals(event.getTargetId())) { - Permanent attached = game.getPermanent(source.getAttachedTo()); - if (attached != null) { + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED; + } - for (Effect e : getEffects()) { - e.setTargetPointer(new FixedTarget(attached.getControllerId())); - } - return true; + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent source = game.getPermanent(this.sourceId); + if (source != null && source.getAttachedTo().equals(event.getTargetId())) { + Permanent attached = game.getPermanent(source.getAttachedTo()); + if (attached != null) { + for (Effect e : getEffects()) { + e.setTargetPointer(new FixedTarget(attached.getControllerId())); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/limitedalpha/ThicketBasilisk.java b/Mage.Sets/src/mage/sets/limitedalpha/ThicketBasilisk.java index 448809c03c..1c8dfda7ce 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/ThicketBasilisk.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/ThicketBasilisk.java @@ -28,21 +28,22 @@ package mage.sets.limitedalpha; import java.util.UUID; -import mage.constants.Outcome; -import mage.constants.Zone; -import mage.abilities.effects.OneShotEffect; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DestroyTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; -import mage.cards.CardImpl; /** * @@ -87,23 +88,26 @@ class ThicketBasiliskTriggeredAbility extends TriggeredAbilityImpl { return new ThicketBasiliskTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BLOCKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) { - Permanent blocker = game.getPermanent(event.getSourceId()); - Permanent blocked = game.getPermanent(event.getTargetId()); - Permanent thicketBasilisk = game.getPermanent(sourceId); - if (blocker != null && blocker != thicketBasilisk - && !blocker.getSubtype().contains("Wall") - && blocked == thicketBasilisk) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId())); - return true; - } - if (blocker != null && blocker == thicketBasilisk - && !blocked.getSubtype().contains("Wall")) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(blocked.getId())); - return true; - } + Permanent blocker = game.getPermanent(event.getSourceId()); + Permanent blocked = game.getPermanent(event.getTargetId()); + Permanent thicketBasilisk = game.getPermanent(sourceId); + if (blocker != null && blocker != thicketBasilisk + && !blocker.getSubtype().contains("Wall") + && blocked == thicketBasilisk) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId())); + return true; + } + if (blocker != null && blocker == thicketBasilisk + && !blocked.getSubtype().contains("Wall")) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(blocked.getId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/limitedalpha/ThroneOfBone.java b/Mage.Sets/src/mage/sets/limitedalpha/ThroneOfBone.java index 529bd128f8..18d571cf30 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/ThroneOfBone.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/ThroneOfBone.java @@ -28,7 +28,6 @@ package mage.sets.limitedalpha; import java.util.UUID; - import mage.ObjectColor; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.GenericManaCost; @@ -40,6 +39,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; /** @@ -82,15 +82,15 @@ class ThroneOfBoneAbility extends TriggeredAbilityImpl { return new ThroneOfBoneAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).contains(ObjectColor.BLACK)) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getColor(game).contains(ObjectColor.BLACK); } @Override diff --git a/Mage.Sets/src/mage/sets/limitedalpha/WoodenSphere.java b/Mage.Sets/src/mage/sets/limitedalpha/WoodenSphere.java index f342a150cc..156dfd3d6a 100644 --- a/Mage.Sets/src/mage/sets/limitedalpha/WoodenSphere.java +++ b/Mage.Sets/src/mage/sets/limitedalpha/WoodenSphere.java @@ -28,7 +28,6 @@ package mage.sets.limitedalpha; import java.util.UUID; - import mage.ObjectColor; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.GenericManaCost; @@ -40,6 +39,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; /** @@ -82,15 +82,15 @@ class WoodenSphereAbility extends TriggeredAbilityImpl { return new WoodenSphereAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).contains(ObjectColor.GREEN)) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getColor(game).contains(ObjectColor.GREEN); } @Override diff --git a/Mage.Sets/src/mage/sets/lorwyn/Dread.java b/Mage.Sets/src/mage/sets/lorwyn/Dread.java index 16658558b8..ec0d5f3470 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/Dread.java +++ b/Mage.Sets/src/mage/sets/lorwyn/Dread.java @@ -94,10 +94,15 @@ class DreadTriggeredAbility extends TriggeredAbilityImpl { public DreadTriggeredAbility copy() { return new DreadTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_PLAYER && event.getPlayerId().equals(this.getControllerId())) { + if (event.getPlayerId().equals(this.getControllerId())) { Permanent permanent = game.getPermanent(event.getSourceId()); if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) { for (Effect effect : this.getEffects()) { diff --git a/Mage.Sets/src/mage/sets/lorwyn/EntanglingTrap.java b/Mage.Sets/src/mage/sets/lorwyn/EntanglingTrap.java index 2df798e1af..8762ed5e81 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/EntanglingTrap.java +++ b/Mage.Sets/src/mage/sets/lorwyn/EntanglingTrap.java @@ -94,9 +94,14 @@ class EntanglingClashTriggeredAbility extends TriggeredAbilityImpl { return new EntanglingClashTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.CLASHED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (EventType.CLASHED.equals(event.getType()) && event.getPlayerId().equals(getControllerId())) { + if (event.getPlayerId().equals(getControllerId())) { if (event.getFlag()) { // clash won addEffect(new DontUntapInControllersNextUntapStepTargetEffect("that creature")); } diff --git a/Mage.Sets/src/mage/sets/lorwyn/RingsOfBrighthearth.java b/Mage.Sets/src/mage/sets/lorwyn/RingsOfBrighthearth.java index 291cbdf40d..51675f87b0 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/RingsOfBrighthearth.java +++ b/Mage.Sets/src/mage/sets/lorwyn/RingsOfBrighthearth.java @@ -84,10 +84,15 @@ class RingsOfBrighthearthTriggeredAbility extends TriggeredAbilityImpl { public RingsOfBrighthearthTriggeredAbility copy() { return new RingsOfBrighthearthTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ACTIVATED_ABILITY; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ACTIVATED_ABILITY && event.getPlayerId().equals(getControllerId())) { + if (event.getPlayerId().equals(getControllerId())) { StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId()); if (!(stackAbility.getStackAbility() instanceof ManaAbility)) { Effect effect = this.getEffects().get(0); diff --git a/Mage.Sets/src/mage/sets/magic2010/HowlingMine.java b/Mage.Sets/src/mage/sets/magic2010/HowlingMine.java index 9ca2d3e923..5ec15b0a5a 100644 --- a/Mage.Sets/src/mage/sets/magic2010/HowlingMine.java +++ b/Mage.Sets/src/mage/sets/magic2010/HowlingMine.java @@ -29,12 +29,12 @@ package mage.sets.magic2010; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DrawCardTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -77,13 +77,15 @@ class HowlingMineAbility extends TriggeredAbilityImpl { return new HowlingMineAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DRAW_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DRAW_STEP_PRE) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); - return true; - } - return false; + this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/magic2010/IceCage.java b/Mage.Sets/src/mage/sets/magic2010/IceCage.java index 1a0b9bc894..911d57ec0d 100644 --- a/Mage.Sets/src/mage/sets/magic2010/IceCage.java +++ b/Mage.Sets/src/mage/sets/magic2010/IceCage.java @@ -29,18 +29,18 @@ package mage.sets.magic2010; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.AttachEffect; -import mage.abilities.effects.common.combat.CantBlockAttackActivateAttachedEffect; import mage.abilities.effects.common.DestroySourceEffect; +import mage.abilities.effects.common.combat.CantBlockAttackActivateAttachedEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -99,14 +99,17 @@ class IceCageAbility extends TriggeredAbilityImpl { return new IceCageAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TARGETED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.TARGETED) { - Permanent enchantment = game.getPermanent(sourceId); - if (enchantment != null && enchantment.getAttachedTo() != null) { - if (event.getTargetId().equals(enchantment.getAttachedTo())) { - return true; - } + Permanent enchantment = game.getPermanent(sourceId); + if (enchantment != null && enchantment.getAttachedTo() != null) { + if (event.getTargetId().equals(enchantment.getAttachedTo())) { + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/magic2010/LightwielderPaladin.java b/Mage.Sets/src/mage/sets/magic2010/LightwielderPaladin.java index b85a136446..b532f4207a 100644 --- a/Mage.Sets/src/mage/sets/magic2010/LightwielderPaladin.java +++ b/Mage.Sets/src/mage/sets/magic2010/LightwielderPaladin.java @@ -28,15 +28,15 @@ package mage.sets.magic2010; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.ObjectColor; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.ExileTargetEffect; import mage.abilities.keyword.FirstStrikeAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorPredicate; @@ -92,10 +92,14 @@ class LightwielderPaladinTriggeredAbility extends TriggeredAbilityImpl { return new LightwielderPaladinTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId) - && ((DamagedPlayerEvent) event).isCombatDamage()) { + if (event.getSourceId().equals(this.sourceId) && ((DamagedPlayerEvent) event).isCombatDamage()) { Player player = game.getPlayer(event.getTargetId()); if (player != null) { FilterPermanent filter = new FilterPermanent("black or red permanent controlled by " + player.getLogName()); diff --git a/Mage.Sets/src/mage/sets/magic2010/SanguineBond.java b/Mage.Sets/src/mage/sets/magic2010/SanguineBond.java index b56127071c..f72721de4f 100644 --- a/Mage.Sets/src/mage/sets/magic2010/SanguineBond.java +++ b/Mage.Sets/src/mage/sets/magic2010/SanguineBond.java @@ -28,14 +28,15 @@ package mage.sets.magic2010; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetOpponent; /** @@ -80,9 +81,14 @@ class SanguineBondTriggeredAbility extends TriggeredAbilityImpl { return new SanguineBondTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.GAINED_LIFE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.GAINED_LIFE && event.getPlayerId().equals(this.controllerId)) { + if (event.getPlayerId().equals(this.controllerId)) { this.getEffects().clear(); this.addEffect(new LoseLifeTargetEffect(event.getAmount())); return true; diff --git a/Mage.Sets/src/mage/sets/magic2011/AjanisPridemate.java b/Mage.Sets/src/mage/sets/magic2011/AjanisPridemate.java index 0818fa5dd9..57e2e4dd19 100644 --- a/Mage.Sets/src/mage/sets/magic2011/AjanisPridemate.java +++ b/Mage.Sets/src/mage/sets/magic2011/AjanisPridemate.java @@ -29,13 +29,13 @@ package mage.sets.magic2011; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; @@ -85,12 +85,14 @@ class AjanisPridemateAbility extends TriggeredAbilityImpl { return new AjanisPridemateAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.GAINED_LIFE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.GAINED_LIFE && event.getPlayerId().equals(controllerId)) { - return true; - } - return false; + return event.getPlayerId().equals(controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/magic2011/ChandrasSpitfire.java b/Mage.Sets/src/mage/sets/magic2011/ChandrasSpitfire.java index 1154a69bd6..8a4c98ab7b 100644 --- a/Mage.Sets/src/mage/sets/magic2011/ChandrasSpitfire.java +++ b/Mage.Sets/src/mage/sets/magic2011/ChandrasSpitfire.java @@ -29,18 +29,19 @@ package mage.sets.magic2011; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -81,15 +82,15 @@ class ChandrasSpitfireAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - if (!damageEvent.isCombatDamage() && game.getOpponents(controllerId).contains(event.getTargetId())) { - return true; - } - } - return false; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + return !damageEvent.isCombatDamage() && game.getOpponents(controllerId).contains(event.getTargetId()); } @Override diff --git a/Mage.Sets/src/mage/sets/magic2011/GraveTitan.java b/Mage.Sets/src/mage/sets/magic2011/GraveTitan.java index 4282f7e051..b478145b76 100644 --- a/Mage.Sets/src/mage/sets/magic2011/GraveTitan.java +++ b/Mage.Sets/src/mage/sets/magic2011/GraveTitan.java @@ -29,14 +29,14 @@ package mage.sets.magic2011; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.keyword.DeathtouchAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -86,6 +86,11 @@ class GraveTitanAbility extends TriggeredAbilityImpl { return new GraveTitanAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { diff --git a/Mage.Sets/src/mage/sets/magic2011/InfernoTitan.java b/Mage.Sets/src/mage/sets/magic2011/InfernoTitan.java index 083d75001f..484242f65d 100644 --- a/Mage.Sets/src/mage/sets/magic2011/InfernoTitan.java +++ b/Mage.Sets/src/mage/sets/magic2011/InfernoTitan.java @@ -29,17 +29,17 @@ package mage.sets.magic2011; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.DamageMultiEffect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -90,6 +90,11 @@ class InfernoTitanAbility extends TriggeredAbilityImpl { return new InfernoTitanAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { diff --git a/Mage.Sets/src/mage/sets/magic2011/LilianasCaress.java b/Mage.Sets/src/mage/sets/magic2011/LilianasCaress.java index de0eea24e4..3166f1aaed 100644 --- a/Mage.Sets/src/mage/sets/magic2011/LilianasCaress.java +++ b/Mage.Sets/src/mage/sets/magic2011/LilianasCaress.java @@ -82,10 +82,15 @@ class LilianasCaressAbility extends TriggeredAbilityImpl { return new LilianasCaressAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DISCARDED_CARD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DISCARDED_CARD && game.getOpponents(controllerId).contains(event.getPlayerId())) { - for (Effect effect :this.getEffects()) { + if (game.getOpponents(controllerId).contains(event.getPlayerId())) { + for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } return true; diff --git a/Mage.Sets/src/mage/sets/magic2011/PrimalCocoon.java b/Mage.Sets/src/mage/sets/magic2011/PrimalCocoon.java index 4cf1ce2149..a510afc62c 100644 --- a/Mage.Sets/src/mage/sets/magic2011/PrimalCocoon.java +++ b/Mage.Sets/src/mage/sets/magic2011/PrimalCocoon.java @@ -29,17 +29,17 @@ package mage.sets.magic2011; import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.DestroySourceEffect; +import mage.abilities.effects.common.counter.AddPlusOneCountersAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; -import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.common.counter.AddPlusOneCountersAttachedEffect; -import mage.abilities.effects.common.AttachEffect; -import mage.abilities.effects.common.DestroySourceEffect; -import mage.abilities.keyword.EnchantAbility; -import mage.cards.CardImpl; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -94,12 +94,14 @@ class PrimalCocoonAbility1 extends TriggeredAbilityImpl { return new PrimalCocoonAbility1(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { - return true; - } - return false; + return event.getPlayerId().equals(this.controllerId); } @Override @@ -123,15 +125,15 @@ class PrimalCocoonAbility2 extends TriggeredAbilityImpl { return new PrimalCocoonAbility2(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.BLOCKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.BLOCKER_DECLARED) { - Permanent enchantment = game.getPermanent(sourceId); - if (enchantment != null && enchantment.getAttachedTo() != null && event.getSourceId() != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - return true; - } - } - return false; + Permanent enchantment = game.getPermanent(sourceId); + return enchantment != null && enchantment.getAttachedTo() != null && event.getSourceId() != null && event.getSourceId().equals(enchantment.getAttachedTo()); } @Override diff --git a/Mage.Sets/src/mage/sets/magic2011/SunTitan.java b/Mage.Sets/src/mage/sets/magic2011/SunTitan.java index 050b9d6ce2..03f7d21a76 100644 --- a/Mage.Sets/src/mage/sets/magic2011/SunTitan.java +++ b/Mage.Sets/src/mage/sets/magic2011/SunTitan.java @@ -29,14 +29,14 @@ package mage.sets.magic2011; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.Filter.ComparisonType; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; @@ -107,6 +107,11 @@ class SunTitanAbility extends TriggeredAbilityImpl { return new SunTitanAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { diff --git a/Mage.Sets/src/mage/sets/magic2012/ChandraTheFirebrand.java b/Mage.Sets/src/mage/sets/magic2012/ChandraTheFirebrand.java index f06f9cda10..3677a7b9cc 100644 --- a/Mage.Sets/src/mage/sets/magic2012/ChandraTheFirebrand.java +++ b/Mage.Sets/src/mage/sets/magic2012/ChandraTheFirebrand.java @@ -29,9 +29,6 @@ package mage.sets.magic2012; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.LoyaltyAbility; import mage.abilities.common.EntersBattlefieldAbility; @@ -41,9 +38,13 @@ import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.target.common.TargetCreatureOrPlayer; import mage.target.targetpointer.FixedTarget; @@ -103,9 +104,14 @@ class ChandraTheFirebrandAbility extends DelayedTriggeredAbility { return new ChandraTheFirebrandAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(this.getControllerId())) { + if (event.getPlayerId().equals(this.getControllerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && (spell.getCardType().contains(CardType.INSTANT) || spell.getCardType().contains(CardType.SORCERY))) { for (Effect effect : this.getEffects()) { diff --git a/Mage.Sets/src/mage/sets/magic2012/ChandrasPhoenix.java b/Mage.Sets/src/mage/sets/magic2012/ChandrasPhoenix.java index 27c7871faf..1aeed25f2d 100644 --- a/Mage.Sets/src/mage/sets/magic2012/ChandrasPhoenix.java +++ b/Mage.Sets/src/mage/sets/magic2012/ChandrasPhoenix.java @@ -28,9 +28,6 @@ package mage.sets.magic2012; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.ReturnToHandSourceEffect; @@ -38,9 +35,12 @@ import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.HasteAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -85,15 +85,18 @@ class ChandrasPhoenixTriggeredAbility extends TriggeredAbilityImpl { return new ChandrasPhoenixTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { - if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) { - Card c = game.getCard(event.getSourceId()); - if (c != null) { - if (c.getColor(game).isRed() && (c.getCardType().contains(CardType.PLANESWALKER) || c.getCardType().contains(CardType.INSTANT) || c.getCardType().contains(CardType.SORCERY))) { - return true; - } + if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) { + Card c = game.getCard(event.getSourceId()); + if (c != null) { + if (c.getColor(game).isRed() && (c.getCardType().contains(CardType.PLANESWALKER) || c.getCardType().contains(CardType.INSTANT) || c.getCardType().contains(CardType.SORCERY))) { + return true; } } } diff --git a/Mage.Sets/src/mage/sets/magic2012/CircleOfFlame.java b/Mage.Sets/src/mage/sets/magic2012/CircleOfFlame.java index 7377f637e5..be8206d7cb 100644 --- a/Mage.Sets/src/mage/sets/magic2012/CircleOfFlame.java +++ b/Mage.Sets/src/mage/sets/magic2012/CircleOfFlame.java @@ -28,17 +28,17 @@ package mage.sets.magic2012; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -82,33 +82,35 @@ class CircleOfFlameTriggeredAbility extends TriggeredAbilityImpl { return new CircleOfFlameTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) { + // check has flying + Permanent attacker = game.getPermanent(event.getSourceId()); + if (attacker == null || attacker.getAbilities().contains(FlyingAbility.getInstance())) { + return false; + } - // check has flying - Permanent attacker = game.getPermanent(event.getSourceId()); - if (attacker == null || attacker.getAbilities().contains(FlyingAbility.getInstance())) { - return false; - } - - // check attacks you - boolean youOrYourPlaneswalker = false; - boolean you = event.getTargetId().equals(this.getControllerId()); - if (you) { - youOrYourPlaneswalker = true; - } else{ // check attacks your planeswalker - Permanent permanent = game.getPermanent(event.getTargetId()); - youOrYourPlaneswalker = permanent != null - && permanent.getCardType().contains(CardType.PLANESWALKER) - && permanent.getControllerId().equals(this.getControllerId()); - } - if (youOrYourPlaneswalker) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(attacker.getId())); - } - return true; + // check attacks you + boolean youOrYourPlaneswalker; + boolean you = event.getTargetId().equals(this.getControllerId()); + if (you) { + youOrYourPlaneswalker = true; + } else{ // check attacks your planeswalker + Permanent permanent = game.getPermanent(event.getTargetId()); + youOrYourPlaneswalker = permanent != null + && permanent.getCardType().contains(CardType.PLANESWALKER) + && permanent.getControllerId().equals(this.getControllerId()); + } + if (youOrYourPlaneswalker) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(attacker.getId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/magic2012/GideonsAvenger.java b/Mage.Sets/src/mage/sets/magic2012/GideonsAvenger.java index 77e9c98bab..be7f26d112 100644 --- a/Mage.Sets/src/mage/sets/magic2012/GideonsAvenger.java +++ b/Mage.Sets/src/mage/sets/magic2012/GideonsAvenger.java @@ -28,17 +28,17 @@ package mage.sets.magic2012; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -83,14 +83,17 @@ class GideonsAvengerTriggeredAbility extends TriggeredAbilityImpl { return new GideonsAvengerTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TAPPED) { - Permanent p = game.getPermanent(event.getTargetId()); - if (p != null && p.getCardType().contains(CardType.CREATURE)) { - if (game.getOpponents(this.controllerId).contains(p.getControllerId())) - return true; - } + Permanent p = game.getPermanent(event.getTargetId()); + if (p != null && p.getCardType().contains(CardType.CREATURE)) { + if (game.getOpponents(this.controllerId).contains(p.getControllerId())) + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/magic2012/HuntersInsight.java b/Mage.Sets/src/mage/sets/magic2012/HuntersInsight.java index 2e54d86336..c580c5679b 100644 --- a/Mage.Sets/src/mage/sets/magic2012/HuntersInsight.java +++ b/Mage.Sets/src/mage/sets/magic2012/HuntersInsight.java @@ -28,14 +28,14 @@ package mage.sets.magic2012; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedEvent; import mage.game.events.GameEvent; @@ -83,10 +83,14 @@ class HuntersInsightTriggeredAbility extends TriggeredAbilityImpl { return new HuntersInsightTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER || event.getType() == EventType.DAMAGED_PLANESWALKER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if ((event.getType() == EventType.DAMAGED_PLAYER || event.getType() == EventType.DAMAGED_PLANESWALKER) - && event.getSourceId().equals(this.sourceId) && ((DamagedEvent) event).isCombatDamage()) { + if (event.getSourceId().equals(this.sourceId) && ((DamagedEvent) event).isCombatDamage()) { this.getEffects().clear(); this.addEffect(new DrawCardSourceControllerEffect(event.getAmount())); return true; diff --git a/Mage.Sets/src/mage/sets/magic2012/RitesOfFlourishing.java b/Mage.Sets/src/mage/sets/magic2012/RitesOfFlourishing.java index 14f33e50ca..5318f83ad4 100644 --- a/Mage.Sets/src/mage/sets/magic2012/RitesOfFlourishing.java +++ b/Mage.Sets/src/mage/sets/magic2012/RitesOfFlourishing.java @@ -28,16 +28,17 @@ package mage.sets.magic2012; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.DrawCardTargetEffect; import mage.abilities.effects.common.continuous.PlayAdditionalLandsAllEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -82,13 +83,15 @@ class RitesOfFlourishingAbility extends TriggeredAbilityImpl { return new RitesOfFlourishingAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DRAW_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DRAW_STEP_PRE) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); - return true; - } - return false; + this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/magic2012/WarstormSurge.java b/Mage.Sets/src/mage/sets/magic2012/WarstormSurge.java index dac1f2a8da..9ec321e275 100644 --- a/Mage.Sets/src/mage/sets/magic2012/WarstormSurge.java +++ b/Mage.Sets/src/mage/sets/magic2012/WarstormSurge.java @@ -28,15 +28,15 @@ package mage.sets.magic2012; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -80,16 +80,19 @@ class WarstormSurgeTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) { - Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent.getCardType().contains(CardType.CREATURE) - && permanent.getControllerId().equals(this.controllerId)) { - Effect effect = this.getEffects().get(0); - effect.setValue("damageSource", event.getTargetId()); - return true; - } + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent.getCardType().contains(CardType.CREATURE) + && permanent.getControllerId().equals(this.controllerId)) { + Effect effect = this.getEffects().get(0); + effect.setValue("damageSource", event.getTargetId()); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/magic2012/Worldslayer.java b/Mage.Sets/src/mage/sets/magic2012/Worldslayer.java index 9468b0554c..84ee5ea38f 100644 --- a/Mage.Sets/src/mage/sets/magic2012/Worldslayer.java +++ b/Mage.Sets/src/mage/sets/magic2012/Worldslayer.java @@ -29,19 +29,20 @@ package mage.sets.magic2012; import java.util.List; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -84,16 +85,16 @@ class WorldslayerTriggeredAbility extends TriggeredAbilityImpl { return new WorldslayerTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; - Permanent p = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { - return true; - } - } - return false; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + Permanent p = game.getPermanent(event.getSourceId()); + return damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/magic2013/BloodReckoning.java b/Mage.Sets/src/mage/sets/magic2013/BloodReckoning.java index ad16db66da..45113efc7c 100644 --- a/Mage.Sets/src/mage/sets/magic2013/BloodReckoning.java +++ b/Mage.Sets/src/mage/sets/magic2013/BloodReckoning.java @@ -28,18 +28,18 @@ package mage.sets.magic2013; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; +import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; -import mage.abilities.effects.common.LoseLifeTargetEffect; /** * @@ -81,31 +81,34 @@ class BloodReckoningTriggeredAbility extends TriggeredAbilityImpl { return new BloodReckoningTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) { - Permanent attacker = game.getPermanent(event.getSourceId()); - if (attacker != null) { - // check attacks you - boolean youOrYourPlaneswalker = false; - boolean you = event.getTargetId().equals(this.getControllerId()); - if (you) { - youOrYourPlaneswalker = true; - } else{ // check attacks your planeswalker - Permanent permanent = game.getPermanent(event.getTargetId()); - youOrYourPlaneswalker = permanent != null - && permanent.getCardType().contains(CardType.PLANESWALKER) - && permanent.getControllerId().equals(this.getControllerId()); - } - if (youOrYourPlaneswalker) { - for (Effect effect : this.getEffects()) { - UUID controller = attacker.getControllerId(); - if (controller != null) { - effect.setTargetPointer(new FixedTarget(controller)); - } + Permanent attacker = game.getPermanent(event.getSourceId()); + if (attacker != null) { + // check attacks you + boolean youOrYourPlaneswalker = false; + boolean you = event.getTargetId().equals(this.getControllerId()); + if (you) { + youOrYourPlaneswalker = true; + } else{ // check attacks your planeswalker + Permanent permanent = game.getPermanent(event.getTargetId()); + youOrYourPlaneswalker = permanent != null + && permanent.getCardType().contains(CardType.PLANESWALKER) + && permanent.getControllerId().equals(this.getControllerId()); + } + if (youOrYourPlaneswalker) { + for (Effect effect : this.getEffects()) { + UUID controller = attacker.getControllerId(); + if (controller != null) { + effect.setTargetPointer(new FixedTarget(controller)); } - return true; } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/magic2013/HamletbackGoliath.java b/Mage.Sets/src/mage/sets/magic2013/HamletbackGoliath.java index 83c91c3983..f02794b92b 100644 --- a/Mage.Sets/src/mage/sets/magic2013/HamletbackGoliath.java +++ b/Mage.Sets/src/mage/sets/magic2013/HamletbackGoliath.java @@ -28,20 +28,20 @@ package mage.sets.magic2013; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -88,18 +88,21 @@ class HamletbackGoliathTriggeredAbility extends TriggeredAbilityImpl { return new HamletbackGoliathTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - UUID targetId = event.getTargetId(); - Permanent permanent = game.getPermanent(targetId); - if (permanent.getCardType().contains(CardType.CREATURE) - && !(targetId.equals(this.getSourceId()))) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - } - return true; + UUID targetId = event.getTargetId(); + Permanent permanent = game.getPermanent(targetId); + if (permanent.getCardType().contains(CardType.CREATURE) + && !(targetId.equals(this.getSourceId()))) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/magic2013/NefaroxOverlordOfGrixis.java b/Mage.Sets/src/mage/sets/magic2013/NefaroxOverlordOfGrixis.java index 9dc0c2910a..a6f7b79e94 100644 --- a/Mage.Sets/src/mage/sets/magic2013/NefaroxOverlordOfGrixis.java +++ b/Mage.Sets/src/mage/sets/magic2013/NefaroxOverlordOfGrixis.java @@ -27,23 +27,23 @@ */ package mage.sets.magic2013; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.SacrificeEffect; import mage.abilities.keyword.ExaltedAbility; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; -import java.util.UUID; - /** * * @author jeffwadsworth @@ -99,9 +99,14 @@ class NefaroxOverlordOfGrixisTriggeredAbility extends TriggeredAbilityImpl { return new NefaroxOverlordOfGrixisTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DECLARED_ATTACKERS && game.getActivePlayerId().equals(this.controllerId) ) { + if (game.getActivePlayerId().equals(this.controllerId) ) { UUID nefarox = this.getSourceId(); if (nefarox != null) { if (game.getCombat().attacksAlone() && nefarox == game.getCombat().getAttackers().get(0)) { diff --git a/Mage.Sets/src/mage/sets/magic2013/OdricMasterTactician.java b/Mage.Sets/src/mage/sets/magic2013/OdricMasterTactician.java index 7ccca5333b..4ff2a34e1b 100644 --- a/Mage.Sets/src/mage/sets/magic2013/OdricMasterTactician.java +++ b/Mage.Sets/src/mage/sets/magic2013/OdricMasterTactician.java @@ -27,19 +27,23 @@ */ package mage.sets.magic2013; -import mage.constants.*; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.keyword.FirstStrikeAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; -import java.util.UUID; - /** * @author noxx */ @@ -87,14 +91,17 @@ class OdricMasterTacticianTriggeredAbility extends TriggeredAbilityImpl { return new OdricMasterTacticianTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DECLARED_ATTACKERS) { - resetEffect(); - if (game.getCombat().getAttackers().size() >= 4 && game.getCombat().getAttackers().contains(this.sourceId)) { - enableEffect(); - return true; - } + resetEffect(); + if (game.getCombat().getAttackers().size() >= 4 && game.getCombat().getAttackers().contains(this.sourceId)) { + enableEffect(); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/magic2013/SlumberingDragon.java b/Mage.Sets/src/mage/sets/magic2013/SlumberingDragon.java index 31bef35ef9..e822e2fdb3 100644 --- a/Mage.Sets/src/mage/sets/magic2013/SlumberingDragon.java +++ b/Mage.Sets/src/mage/sets/magic2013/SlumberingDragon.java @@ -28,9 +28,6 @@ package mage.sets.magic2013; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -39,11 +36,14 @@ import mage.abilities.effects.RestrictionEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -136,18 +136,21 @@ class SlumberingDragonTriggeredAbility extends TriggeredAbilityImpl { return new SlumberingDragonTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) { - if (event.getTargetId().equals(controllerId)) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId())); - return true; - } - Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent != null && permanent.getCardType().contains(CardType.PLANESWALKER) && permanent.getControllerId().equals(controllerId)) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId())); - return true; - } + if (event.getTargetId().equals(controllerId)) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId())); + return true; + } + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent != null && permanent.getCardType().contains(CardType.PLANESWALKER) && permanent.getControllerId().equals(controllerId)) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/magic2014/ArchangelOfThune.java b/Mage.Sets/src/mage/sets/magic2014/ArchangelOfThune.java index 35ac93db9b..f03ff58485 100644 --- a/Mage.Sets/src/mage/sets/magic2014/ArchangelOfThune.java +++ b/Mage.Sets/src/mage/sets/magic2014/ArchangelOfThune.java @@ -41,6 +41,7 @@ import mage.counters.CounterType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -90,12 +91,14 @@ class ArchangelOfThuneAbility extends TriggeredAbilityImpl { return new ArchangelOfThuneAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.GAINED_LIFE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.GAINED_LIFE && event.getPlayerId().equals(controllerId)) { - return true; - } - return false; + return event.getPlayerId().equals(controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/magic2014/ColossalWhale.java b/Mage.Sets/src/mage/sets/magic2014/ColossalWhale.java index b6f2de8f32..187439dba2 100644 --- a/Mage.Sets/src/mage/sets/magic2014/ColossalWhale.java +++ b/Mage.Sets/src/mage/sets/magic2014/ColossalWhale.java @@ -45,6 +45,7 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; import mage.util.CardUtil; @@ -92,9 +93,14 @@ class ColossalWhaleAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { + if (event.getSourceId().equals(this.getSourceId())) { FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls"); UUID defenderId = game.getCombat().getDefenderId(sourceId); filter.add(new ControllerIdPredicate(defenderId)); diff --git a/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java b/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java index 162acea479..5cbd32e409 100644 --- a/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java +++ b/Mage.Sets/src/mage/sets/magic2014/DoorOfDestinies.java @@ -28,7 +28,6 @@ package mage.sets.magic2014; import java.util.UUID; -import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.AsEntersBattlefieldAbility; @@ -52,10 +51,10 @@ import mage.counters.CounterType; import mage.filter.FilterSpell; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.stack.Spell; import mage.players.Player; @@ -141,20 +140,23 @@ class AddCounterAbility extends TriggeredAbilityImpl { return new AddCounterAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent doorOfDestinies = game.getPermanent(getSourceId()); if (doorOfDestinies != null) { String subtype = (String) game.getState().getValue(doorOfDestinies.getId() + "_type"); if (subtype != null) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - FilterSpell filter = new FilterSpell(); - filter.add(new ControllerPredicate(TargetController.YOU)); - filter.add(new SubtypePredicate(subtype)); - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && filter.match(spell, controllerId, game)) { - return true; - } + FilterSpell filter = new FilterSpell(); + filter.add(new ControllerPredicate(TargetController.YOU)); + filter.add(new SubtypePredicate(subtype)); + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null && filter.match(spell, controllerId, game)) { + return true; } } } diff --git a/Mage.Sets/src/mage/sets/magic2014/GuardianOfTheAges.java b/Mage.Sets/src/mage/sets/magic2014/GuardianOfTheAges.java index a2abff465b..6ef6c1266a 100644 --- a/Mage.Sets/src/mage/sets/magic2014/GuardianOfTheAges.java +++ b/Mage.Sets/src/mage/sets/magic2014/GuardianOfTheAges.java @@ -28,13 +28,13 @@ package mage.sets.magic2014; import java.util.UUID; -import mage.cards.CardImpl; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.keyword.DefenderAbility; -import mage.abilities.keyword.TrampleAbility; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; import mage.abilities.effects.common.continuous.LoseAbilitySourceEffect; +import mage.abilities.keyword.DefenderAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; @@ -43,6 +43,7 @@ import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -86,16 +87,19 @@ class GuardianOfTheAgesTriggerAbility extends TriggeredAbilityImpl { public GuardianOfTheAgesTriggerAbility(final GuardianOfTheAgesTriggerAbility ability){ super(ability); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } @Override public boolean checkTrigger(GameEvent event, Game game){ - if(event.getType() == GameEvent.EventType.ATTACKER_DECLARED){ - Permanent creature = game.getPermanent(event.getSourceId()); - if(creature != null && filter.match(creature, game) - && game.getOpponents(this.getControllerId()).contains(creature.getControllerId()) - && game.getPermanent(this.getSourceId()).getAbilities().contains(DefenderAbility.getInstance())) { - return true; - } + Permanent creature = game.getPermanent(event.getSourceId()); + if (creature != null && filter.match(creature, game) + && game.getOpponents(this.getControllerId()).contains(creature.getControllerId()) + && game.getPermanent(this.getSourceId()).getAbilities().contains(DefenderAbility.getInstance())) { + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/magic2014/IllusionaryArmor.java b/Mage.Sets/src/mage/sets/magic2014/IllusionaryArmor.java index 0a6947cbb5..07129d69f2 100644 --- a/Mage.Sets/src/mage/sets/magic2014/IllusionaryArmor.java +++ b/Mage.Sets/src/mage/sets/magic2014/IllusionaryArmor.java @@ -42,6 +42,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; @@ -95,14 +96,17 @@ class IllusionaryArmorAbility extends TriggeredAbilityImpl { return new IllusionaryArmorAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TARGETED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TARGETED) { - Permanent enchantment = game.getPermanent(sourceId); - if (enchantment != null && enchantment.getAttachedTo() != null) { - if (event.getTargetId().equals(enchantment.getAttachedTo())) { - return true; - } + Permanent enchantment = game.getPermanent(sourceId); + if (enchantment != null && enchantment.getAttachedTo() != null) { + if (event.getTargetId().equals(enchantment.getAttachedTo())) { + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/magic2014/PathOfBravery.java b/Mage.Sets/src/mage/sets/magic2014/PathOfBravery.java index 91ecb779aa..b537128b3f 100644 --- a/Mage.Sets/src/mage/sets/magic2014/PathOfBravery.java +++ b/Mage.Sets/src/mage/sets/magic2014/PathOfBravery.java @@ -46,6 +46,7 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; /** @@ -112,14 +113,14 @@ class PathOfBraveryTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DECLARED_ATTACKERS - && !game.getCombat().noAttackers() - && event.getPlayerId().equals(controllerId)) { - return true; - } - return false; + return !game.getCombat().noAttackers() && event.getPlayerId().equals(controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/magic2014/WindreaderSphinx.java b/Mage.Sets/src/mage/sets/magic2014/WindreaderSphinx.java index bf937abb29..975240eb20 100644 --- a/Mage.Sets/src/mage/sets/magic2014/WindreaderSphinx.java +++ b/Mage.Sets/src/mage/sets/magic2014/WindreaderSphinx.java @@ -40,6 +40,7 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.AbilityPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -87,15 +88,15 @@ class WindreaderSphinxTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED ) { - Permanent attacker = game.getPermanent(event.getSourceId()); - if (attacker != null && filter.match(attacker, game)) { - return true; - } - } - return false; + Permanent attacker = game.getPermanent(event.getSourceId()); + return attacker != null && filter.match(attacker, game); } @Override diff --git a/Mage.Sets/src/mage/sets/magic2014/Witchstalker.java b/Mage.Sets/src/mage/sets/magic2014/Witchstalker.java index 1a2fe2b3db..2ef916758e 100644 --- a/Mage.Sets/src/mage/sets/magic2014/Witchstalker.java +++ b/Mage.Sets/src/mage/sets/magic2014/Witchstalker.java @@ -43,6 +43,7 @@ import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; /** @@ -92,19 +93,18 @@ class WitchstalkerTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - // Opponent casts spell during your turn - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null - && filter.match(spell,game) - && game.getOpponents(this.getControllerId()).contains(spell.getControllerId()) - && game.getActivePlayerId().equals(this.getControllerId())) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null + && filter.match(spell,game) + && game.getOpponents(this.getControllerId()).contains(spell.getControllerId()) + && game.getActivePlayerId().equals(this.getControllerId()); } @Override diff --git a/Mage.Sets/src/mage/sets/magic2015/HotSoup.java b/Mage.Sets/src/mage/sets/magic2015/HotSoup.java index b14a940e4e..4404b0c357 100644 --- a/Mage.Sets/src/mage/sets/magic2015/HotSoup.java +++ b/Mage.Sets/src/mage/sets/magic2015/HotSoup.java @@ -43,6 +43,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -91,19 +92,22 @@ class HotSoupTriggeredAbility extends TriggeredAbilityImpl { public HotSoupTriggeredAbility copy() { return new HotSoupTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) { - Permanent equipment = game.getPermanent(this.getSourceId()); - if (equipment != null && equipment.getAttachedTo() != null) { - if (event.getTargetId() == equipment.getAttachedTo()) { - for(Effect effect : this.getEffects()) - { - effect.setTargetPointer(new FixedTarget(equipment.getAttachedTo())); - } - return true; + Permanent equipment = game.getPermanent(this.getSourceId()); + if (equipment != null && equipment.getAttachedTo() != null) { + if (event.getTargetId() == equipment.getAttachedTo()) { + for(Effect effect : this.getEffects()) + { + effect.setTargetPointer(new FixedTarget(equipment.getAttachedTo())); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/magic2015/KurkeshOnakkeAncient.java b/Mage.Sets/src/mage/sets/magic2015/KurkeshOnakkeAncient.java index f662144a93..3838c745cd 100644 --- a/Mage.Sets/src/mage/sets/magic2015/KurkeshOnakkeAncient.java +++ b/Mage.Sets/src/mage/sets/magic2015/KurkeshOnakkeAncient.java @@ -93,18 +93,21 @@ class KurkeshOnakkeAncientTriggeredAbility extends TriggeredAbilityImpl { public KurkeshOnakkeAncientTriggeredAbility copy() { return new KurkeshOnakkeAncientTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ACTIVATED_ABILITY; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ACTIVATED_ABILITY) { - Card source = game.getPermanentOrLKIBattlefield(event.getSourceId()); - if (source.getCardType().contains(CardType.ARTIFACT)) { - StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId()); - if (!(stackAbility.getStackAbility() instanceof ManaAbility)) { - Effect effect = this.getEffects().get(0); - effect.setValue("stackAbility", stackAbility.getStackAbility()); - return true; - } + Card source = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (source.getCardType().contains(CardType.ARTIFACT)) { + StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId()); + if (!(stackAbility.getStackAbility() instanceof ManaAbility)) { + Effect effect = this.getEffects().get(0); + effect.setValue("stackAbility", stackAbility.getStackAbility()); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/magic2015/MilitaryIntelligence.java b/Mage.Sets/src/mage/sets/magic2015/MilitaryIntelligence.java index 2ae4449ff7..e4830e2ed8 100644 --- a/Mage.Sets/src/mage/sets/magic2015/MilitaryIntelligence.java +++ b/Mage.Sets/src/mage/sets/magic2015/MilitaryIntelligence.java @@ -37,6 +37,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -78,14 +79,14 @@ class MilitaryIntelligenceTriggeredAbility extends TriggeredAbilityImpl { return new MilitaryIntelligenceTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DECLARED_ATTACKERS) { - if (game.getCombat().getAttackers().size() >= 2 && game.getCombat().getAttackerId().equals(getControllerId())) { - return true; - } - } - return false; + return game.getCombat().getAttackers().size() >= 2 && game.getCombat().getAttackerId().equals(getControllerId()); } @Override diff --git a/Mage.Sets/src/mage/sets/magic2015/NetcasterSpider.java b/Mage.Sets/src/mage/sets/magic2015/NetcasterSpider.java index 9e906d5e41..bb12bea1b9 100644 --- a/Mage.Sets/src/mage/sets/magic2015/NetcasterSpider.java +++ b/Mage.Sets/src/mage/sets/magic2015/NetcasterSpider.java @@ -83,13 +83,15 @@ class BlocksCreatureWithFlyingTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BLOCKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.BLOCKER_DECLARED && event.getSourceId().equals(this.getSourceId()) - && game.getPermanent(event.getTargetId()).getAbilities().containsKey(FlyingAbility.getInstance().getId())) { - return true; - } - return false; + return event.getSourceId().equals(this.getSourceId()) + && game.getPermanent(event.getTargetId()).getAbilities().containsKey(FlyingAbility.getInstance().getId()); } @Override diff --git a/Mage.Sets/src/mage/sets/magic2015/ObNixilisUnshackled.java b/Mage.Sets/src/mage/sets/magic2015/ObNixilisUnshackled.java index fd7afe9f5c..3becd6b81d 100644 --- a/Mage.Sets/src/mage/sets/magic2015/ObNixilisUnshackled.java +++ b/Mage.Sets/src/mage/sets/magic2015/ObNixilisUnshackled.java @@ -101,16 +101,19 @@ class ObNixilisUnshackledTriggeredAbility extends TriggeredAbilityImpl { public ObNixilisUnshackledTriggeredAbility copy() { return new ObNixilisUnshackledTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.LIBRARY_SEARCHED; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.LIBRARY_SEARCHED) { - Player controller = game.getPlayer(this.getControllerId()); - if (controller != null && game.isOpponent(controller, event.getTargetId())) { - this.addTarget(new TargetPlayer()); - getTargets().get(0).add(event.getPlayerId(), game); - return true; - } + Player controller = game.getPlayer(this.getControllerId()); + if (controller != null && game.isOpponent(controller, event.getTargetId())) { + this.addTarget(new TargetPlayer()); + getTargets().get(0).add(event.getPlayerId(), game); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/magic2015/ProfaneMemento.java b/Mage.Sets/src/mage/sets/magic2015/ProfaneMemento.java index 7729d2e67f..a255b90bb5 100644 --- a/Mage.Sets/src/mage/sets/magic2015/ProfaneMemento.java +++ b/Mage.Sets/src/mage/sets/magic2015/ProfaneMemento.java @@ -37,6 +37,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; /** @@ -77,10 +78,15 @@ class ProfaneMementoTriggeredAbility extends TriggeredAbilityImpl { public ProfaneMementoTriggeredAbility copy() { return new ProfaneMementoTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) { + if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) { Card card = game.getCard(event.getTargetId()); if (card != null && card.getCardType().contains(CardType.CREATURE) && game.getOpponents(controllerId).contains(card.getOwnerId())) { return true; diff --git a/Mage.Sets/src/mage/sets/magic2015/SiegeDragon.java b/Mage.Sets/src/mage/sets/magic2015/SiegeDragon.java index 2b8f9282c2..78d0392cec 100644 --- a/Mage.Sets/src/mage/sets/magic2015/SiegeDragon.java +++ b/Mage.Sets/src/mage/sets/magic2015/SiegeDragon.java @@ -50,6 +50,7 @@ import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -114,9 +115,14 @@ class SiegeDragonAttacksTriggeredAbility extends TriggeredAbilityImpl { return new SiegeDragonAttacksTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return GameEvent.EventType.ATTACKER_DECLARED.equals(event.getType()) && event.getSourceId().equals(this.getSourceId()); + return event.getSourceId().equals(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/magic2015/WallOfLimbs.java b/Mage.Sets/src/mage/sets/magic2015/WallOfLimbs.java index 887c5263a6..1fb7aae3b0 100644 --- a/Mage.Sets/src/mage/sets/magic2015/WallOfLimbs.java +++ b/Mage.Sets/src/mage/sets/magic2015/WallOfLimbs.java @@ -46,6 +46,7 @@ import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.TargetPlayer; /** @@ -102,10 +103,15 @@ class WallOfLimbsTriggeredAbility extends TriggeredAbilityImpl { public WallOfLimbsTriggeredAbility copy() { return new WallOfLimbsTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.GAINED_LIFE; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.GAINED_LIFE && event.getPlayerId().equals(controllerId); + return event.getPlayerId().equals(controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/magic2015/WasteNot.java b/Mage.Sets/src/mage/sets/magic2015/WasteNot.java index a04546e38b..4fba77c7a4 100644 --- a/Mage.Sets/src/mage/sets/magic2015/WasteNot.java +++ b/Mage.Sets/src/mage/sets/magic2015/WasteNot.java @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.token.ZombieToken; /** @@ -87,10 +88,15 @@ class WasteNotCreatureTriggeredAbility extends TriggeredAbilityImpl { public WasteNotCreatureTriggeredAbility copy() { return new WasteNotCreatureTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DISCARDED_CARD; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DISCARDED_CARD && game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) { + if (game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) { Card discarded = game.getCard(event.getTargetId()); if (discarded != null && discarded.getCardType().contains(CardType.CREATURE)) { return true; @@ -119,10 +125,15 @@ class WasteNotLandTriggeredAbility extends TriggeredAbilityImpl { public WasteNotLandTriggeredAbility copy() { return new WasteNotLandTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DISCARDED_CARD; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DISCARDED_CARD && game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) { + if (game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) { Card discarded = game.getCard(event.getTargetId()); if (discarded != null && discarded.getCardType().contains(CardType.LAND)) { return true; @@ -151,10 +162,15 @@ class WasteNotOtherTriggeredAbility extends TriggeredAbilityImpl { public WasteNotOtherTriggeredAbility copy() { return new WasteNotOtherTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DISCARDED_CARD; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DISCARDED_CARD && game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) { + if (game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) { Card discarded = game.getCard(event.getTargetId()); if (discarded != null && !discarded.getCardType().contains(CardType.LAND) && !discarded.getCardType().contains(CardType.CREATURE)) { return true; diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/CausticWasps.java b/Mage.Sets/src/mage/sets/mercadianmasques/CausticWasps.java index f8db6c978b..0a4049322a 100644 --- a/Mage.Sets/src/mage/sets/mercadianmasques/CausticWasps.java +++ b/Mage.Sets/src/mage/sets/mercadianmasques/CausticWasps.java @@ -92,10 +92,14 @@ class CausticWaspsTriggeredAbility extends TriggeredAbilityImpl { return new CausticWaspsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId) - && ((DamagedPlayerEvent) event).isCombatDamage()) { + if (event.getSourceId().equals(this.sourceId) && ((DamagedPlayerEvent) event).isCombatDamage()) { Player player = game.getPlayer(event.getTargetId()); if (player != null) { FilterPermanent filter = new FilterPermanent("an artifact controlled by " + player.getLogName()); diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/Larceny.java b/Mage.Sets/src/mage/sets/mercadianmasques/Larceny.java index 4cd2a9a7d1..f36b538141 100644 --- a/Mage.Sets/src/mage/sets/mercadianmasques/Larceny.java +++ b/Mage.Sets/src/mage/sets/mercadianmasques/Larceny.java @@ -28,17 +28,17 @@ package mage.sets.mercadianmasques; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -82,18 +82,21 @@ class LarcenyTriggeredAbility extends TriggeredAbilityImpl { return new LarcenyTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { - if (((DamagedPlayerEvent) event).isCombatDamage()) { - Permanent creature = game.getPermanent(event.getSourceId()); - if (creature != null && creature.getControllerId().equals(controllerId)) { - for(Effect effect : this.getEffects()) - { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - return true; + if (((DamagedPlayerEvent) event).isCombatDamage()) { + Permanent creature = game.getPermanent(event.getSourceId()); + if (creature != null && creature.getControllerId().equals(controllerId)) { + for(Effect effect : this.getEffects()) + { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/NoblePurpose.java b/Mage.Sets/src/mage/sets/mercadianmasques/NoblePurpose.java index 8cc87540cf..da8e111ea6 100644 --- a/Mage.Sets/src/mage/sets/mercadianmasques/NoblePurpose.java +++ b/Mage.Sets/src/mage/sets/mercadianmasques/NoblePurpose.java @@ -37,6 +37,7 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -78,19 +79,24 @@ class NoblePurposeTriggeredAbility extends TriggeredAbilityImpl { public NoblePurposeTriggeredAbility copy() { return new NoblePurposeTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE + || event.getType() == EventType.DAMAGED_PLAYER + || event.getType() == EventType.DAMAGED_PLANESWALKER; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedEvent) { - DamagedEvent damageEvent = (DamagedEvent) event; - if (damageEvent.isCombatDamage()) { - Permanent permanent = game.getPermanent(event.getSourceId()); - if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) - && permanent.getControllerId().equals(this.getControllerId())) { - this.getEffects().clear(); - this.getEffects().add(new GainLifeEffect(damageEvent.getAmount())); - return true; - } + DamagedEvent damageEvent = (DamagedEvent) event; + if (damageEvent.isCombatDamage()) { + Permanent permanent = game.getPermanent(event.getSourceId()); + if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) + && permanent.getControllerId().equals(this.getControllerId())) { + this.getEffects().clear(); + this.getEffects().add(new GainLifeEffect(damageEvent.getAmount())); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/mercadianmasques/PiousWarrior.java b/Mage.Sets/src/mage/sets/mercadianmasques/PiousWarrior.java index a068a919de..b1845f275c 100644 --- a/Mage.Sets/src/mage/sets/mercadianmasques/PiousWarrior.java +++ b/Mage.Sets/src/mage/sets/mercadianmasques/PiousWarrior.java @@ -28,19 +28,19 @@ package mage.sets.mercadianmasques; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedCreatureEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; /** @@ -88,10 +88,14 @@ class PiousWarriorTriggeredAbility extends TriggeredAbilityImpl { return new PiousWarriorTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId) - && ((DamagedCreatureEvent)event).isCombatDamage() ) { + if (event.getTargetId().equals(this.sourceId) && ((DamagedCreatureEvent)event).isCombatDamage() ) { this.getEffects().get(0).setValue("damageAmount", event.getAmount()); return true; } diff --git a/Mage.Sets/src/mage/sets/mirage/AmberPrison.java b/Mage.Sets/src/mage/sets/mirage/AmberPrison.java index 1127a3244b..502ac964fb 100644 --- a/Mage.Sets/src/mage/sets/mirage/AmberPrison.java +++ b/Mage.Sets/src/mage/sets/mirage/AmberPrison.java @@ -48,6 +48,7 @@ import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; @@ -177,11 +178,14 @@ class AmberPrisonUntapTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - return event.getType().equals(GameEvent.EventType.UNTAP) && event.getTargetId().equals(this.getSourceId()); - + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UNTAP; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return event.getTargetId().equals(this.getSourceId()); } - } class AmberPrisonReleaseOnUntapEffect extends OneShotEffect { diff --git a/Mage.Sets/src/mage/sets/mirage/RockBasilisk.java b/Mage.Sets/src/mage/sets/mirage/RockBasilisk.java index 6bed4e6f21..66e96becae 100644 --- a/Mage.Sets/src/mage/sets/mirage/RockBasilisk.java +++ b/Mage.Sets/src/mage/sets/mirage/RockBasilisk.java @@ -28,21 +28,22 @@ package mage.sets.mirage; import java.util.UUID; -import mage.constants.Outcome; -import mage.constants.Zone; -import mage.abilities.effects.OneShotEffect; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DestroyTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; -import mage.cards.CardImpl; /** * @@ -87,24 +88,26 @@ class RockBasiliskTriggeredAbility extends TriggeredAbilityImpl { return new RockBasiliskTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BLOCKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) { - Permanent blocker = game.getPermanent(event.getSourceId()); - Permanent blocked = game.getPermanent(event.getTargetId()); - Permanent rockBasilisk = game.getPermanent(sourceId); - if (blocker != null && blocker != rockBasilisk - && !blocker.getSubtype().contains("Wall") - && blocked == rockBasilisk) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId())); - return true; - } - if (blocker != null && blocker == rockBasilisk - && !blocked.getSubtype().contains("Wall")) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(blocked.getId())); - return true; - } - return false; + Permanent blocker = game.getPermanent(event.getSourceId()); + Permanent blocked = game.getPermanent(event.getTargetId()); + Permanent rockBasilisk = game.getPermanent(sourceId); + if (blocker != null && blocker != rockBasilisk + && !blocker.getSubtype().contains("Wall") + && blocked == rockBasilisk) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId())); + return true; + } + if (blocker != null && blocker == rockBasilisk + && !blocked.getSubtype().contains("Wall")) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(blocked.getId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/mirrodin/BansheesBlade.java b/Mage.Sets/src/mage/sets/mirrodin/BansheesBlade.java index 4761b1ac57..896454e695 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/BansheesBlade.java +++ b/Mage.Sets/src/mage/sets/mirrodin/BansheesBlade.java @@ -44,6 +44,7 @@ import mage.counters.CounterType; import mage.game.Game; import mage.game.events.DamagedEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -95,6 +96,14 @@ class BansheesBladeAbility extends TriggeredAbilityImpl { return new BansheesBladeAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER + || event.getType() == EventType.DAMAGED_CREATURE + || event.getType() == EventType.DAMAGED_PLANESWALKER + || event.getType() == EventType.COMBAT_DAMAGE_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event instanceof DamagedEvent && ((DamagedEvent) event).isCombatDamage() && !usedInPhase) { diff --git a/Mage.Sets/src/mage/sets/mirrodin/Glimmervoid.java b/Mage.Sets/src/mage/sets/mirrodin/Glimmervoid.java index 862ed86752..f8f27d33be 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/Glimmervoid.java +++ b/Mage.Sets/src/mage/sets/mirrodin/Glimmervoid.java @@ -28,17 +28,17 @@ package mage.sets.mirrodin; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.mana.AnyColorManaAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterArtifactPermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -81,19 +81,22 @@ class GlimmervoidTriggeredAbility extends TriggeredAbilityImpl { return new GlimmervoidTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE) { - FilterArtifactPermanent filter = new FilterArtifactPermanent(); - if (!game.getBattlefield().contains(filter, controllerId, 1, game)) { - return true; - } + FilterArtifactPermanent filter = new FilterArtifactPermanent(); + if (!game.getBattlefield().contains(filter, controllerId, 1, game)) { + return true; } return false; } @Override public String getRule() { - return "At the beginning of the end step, if you control no Artifacts, sacrifice {this}."; + return "At the beginning of the end step, if you control no artifacts, sacrifice {this}."; } } diff --git a/Mage.Sets/src/mage/sets/mirrodin/MesmericOrb.java b/Mage.Sets/src/mage/sets/mirrodin/MesmericOrb.java index 2725cdf185..7b237c99fe 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/MesmericOrb.java +++ b/Mage.Sets/src/mage/sets/mirrodin/MesmericOrb.java @@ -37,6 +37,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -81,14 +82,17 @@ class BecomesUntappedPermanentTriggeredAbility extends TriggeredAbilityImpl{ return new BecomesUntappedPermanentTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UNTAPPED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UNTAPPED) { - Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent != null) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getControllerId())); - return true; - } + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent != null) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getControllerId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/mirrodin/RustmouthOgre.java b/Mage.Sets/src/mage/sets/mirrodin/RustmouthOgre.java index 3f3361791f..669833fd27 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/RustmouthOgre.java +++ b/Mage.Sets/src/mage/sets/mirrodin/RustmouthOgre.java @@ -40,6 +40,7 @@ import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.TargetPermanent; /** @@ -86,18 +87,21 @@ class RustmouthOgreTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; - if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) { - FilterArtifactPermanent filter = new FilterArtifactPermanent("artifact that player controls"); - filter.add(new ControllerIdPredicate(event.getPlayerId())); - filter.setMessage("artifact controlled by " + game.getPlayer(event.getTargetId()).getLogName()); + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } - this.getTargets().clear(); - this.addTarget(new TargetPermanent(filter)); - return true; - } + @Override + public boolean checkTrigger(GameEvent event, Game game) { + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) { + FilterArtifactPermanent filter = new FilterArtifactPermanent("artifact that player controls"); + filter.add(new ControllerIdPredicate(event.getPlayerId())); + filter.setMessage("artifact controlled by " + game.getPlayer(event.getTargetId()).getLogName()); + + this.getTargets().clear(); + this.addTarget(new TargetPermanent(filter)); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/mirrodin/SwordOfKaldra.java b/Mage.Sets/src/mage/sets/mirrodin/SwordOfKaldra.java index 13387f70c2..cf7921dbde 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/SwordOfKaldra.java +++ b/Mage.Sets/src/mage/sets/mirrodin/SwordOfKaldra.java @@ -93,18 +93,20 @@ class SwordOfKaldraTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_CREATURE) { - Permanent equipment = game.getPermanent(this.getSourceId()); - if (equipment != null - && equipment.getAttachedTo() != null - && event.getSourceId().equals(equipment.getAttachedTo())) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - } - return true; - } + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent equipment = game.getPermanent(this.getSourceId()); + if (equipment != null + && equipment.getAttachedTo() != null + && event.getSourceId().equals(equipment.getAttachedTo())) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); + } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/ConsecratedSphinx.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/ConsecratedSphinx.java index 3b658942d1..738f32b57b 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/ConsecratedSphinx.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/ConsecratedSphinx.java @@ -29,17 +29,17 @@ package mage.sets.mirrodinbesieged; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -83,12 +83,14 @@ class ConsecratedSphinxTriggeredAbility extends TriggeredAbilityImpl { return new ConsecratedSphinxTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DREW_CARD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DREW_CARD && game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) { - return true; - } - return false; + return game.getOpponents(this.getControllerId()).contains(event.getPlayerId()); } @Override diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/GlissaTheTraitor.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/GlissaTheTraitor.java index 9d5026c995..5b9188d929 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/GlissaTheTraitor.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/GlissaTheTraitor.java @@ -29,20 +29,20 @@ package mage.sets.mirrodinbesieged; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.keyword.DeathtouchAbility; import mage.abilities.keyword.FirstStrikeAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.target.common.TargetCardInYourGraveyard; @@ -102,9 +102,14 @@ class GlissaTheTraitorTriggeredAbility extends TriggeredAbilityImpl { return new GlissaTheTraitorTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) { + if (((ZoneChangeEvent)event).isDiesEvent()) { Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (p != null && p.getCardType().contains(CardType.CREATURE) && game.getOpponents(this.getControllerId()).contains(p.getControllerId())) { return true; diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/KnowledgePool.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/KnowledgePool.java index 3a2df2e207..d2146f6213 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/KnowledgePool.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/KnowledgePool.java @@ -27,12 +27,7 @@ */ package mage.sets.mirrodinbesieged; -import mage.target.common.TargetCardInExile; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -40,12 +35,17 @@ import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterNonlandCard; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.players.Player; +import mage.target.common.TargetCardInExile; import mage.target.targetpointer.FixedTarget; /** @@ -122,9 +122,14 @@ class KnowledgePoolAbility extends TriggeredAbilityImpl { return new KnowledgePoolAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.SPELL_CAST && event.getZone() == Zone.HAND) { + if (event.getZone() == Zone.HAND) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null) { for (Effect effect : this.getEffects()) { diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/MagneticMine.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/MagneticMine.java index b84b9b7c1e..1cb4d5ae23 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/MagneticMine.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/MagneticMine.java @@ -28,13 +28,13 @@ package mage.sets.mirrodinbesieged; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -76,17 +76,20 @@ class MagneticMineTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getFromZone() == Zone.BATTLEFIELD - && zEvent.getToZone() == Zone.GRAVEYARD - && zEvent.getTarget().getCardType().contains(CardType.ARTIFACT) - && zEvent.getTarget().getId() != this.getSourceId()) { - this.getTargets().get(0).add(zEvent.getTarget().getControllerId(), game); - return true; - } + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone() == Zone.BATTLEFIELD + && zEvent.getToZone() == Zone.GRAVEYARD + && zEvent.getTarget().getCardType().contains(CardType.ARTIFACT) + && zEvent.getTarget().getId() != this.getSourceId()) { + this.getTargets().get(0).add(zEvent.getTarget().getControllerId(), game); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/MassacreWurm.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/MassacreWurm.java index 69c80992b9..3600167dad 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/MassacreWurm.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/MassacreWurm.java @@ -29,9 +29,6 @@ package mage.sets.mirrodinbesieged; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -39,10 +36,13 @@ import mage.abilities.effects.Effect; import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.continuous.BoostOpponentsEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -89,9 +89,14 @@ class MassacreWurmTriggeredAbility extends TriggeredAbilityImpl { return new MassacreWurmTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) { + if (((ZoneChangeEvent)event).isDiesEvent()) { Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (p != null && p.getCardType().contains(CardType.CREATURE) && game.getOpponents(this.getControllerId()).contains(p.getControllerId())) { for (Effect effect : this.getEffects()) { diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/Mirrorworks.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/Mirrorworks.java index 206e931f52..7e0ecbd777 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/Mirrorworks.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/Mirrorworks.java @@ -41,6 +41,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.permanent.PermanentToken; import mage.game.permanent.token.EmptyToken; @@ -89,9 +90,14 @@ class MirrorworksAbility extends TriggeredAbilityImpl { return new MirrorworksAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && !event.getTargetId().equals(this.getSourceId())) { + if (!event.getTargetId().equals(this.getSourceId())) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null && permanent.getControllerId().equals(getControllerId()) diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/NestedGhoul.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/NestedGhoul.java index 27eae919aa..6751f451c2 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/NestedGhoul.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/NestedGhoul.java @@ -38,6 +38,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.token.ZombieToken; /** @@ -82,12 +83,14 @@ class NestedGhoulTriggeredAbility extends TriggeredAbilityImpl { return new NestedGhoulTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId)) { - return true; - } - return false; + return event.getTargetId().equals(this.sourceId); } @Override diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/Sangromancer.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/Sangromancer.java index 0f644d47df..bfd4bd93dd 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/Sangromancer.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/Sangromancer.java @@ -29,17 +29,17 @@ package mage.sets.mirrodinbesieged; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; @@ -86,9 +86,14 @@ class SangromancerFirstTriggeredAbility extends TriggeredAbilityImpl { return new SangromancerFirstTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) { + if (((ZoneChangeEvent) event).isDiesEvent()) { Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (p != null && p.getCardType().contains(CardType.CREATURE) && game.getOpponents(this.getControllerId()).contains(p.getControllerId())) { return true; @@ -117,12 +122,14 @@ class SangromancerSecondTriggeredAbility extends TriggeredAbilityImpl { return new SangromancerSecondTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DISCARDED_CARD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DISCARDED_CARD && game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) { - return true; - } - return false; + return game.getOpponents(this.getControllerId()).contains(event.getPlayerId()); } @Override diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/SepticRats.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/SepticRats.java index 9dfa604a43..b484423a45 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/SepticRats.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/SepticRats.java @@ -28,19 +28,19 @@ package mage.sets.mirrodinbesieged; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.keyword.InfectAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; /** @@ -85,13 +85,20 @@ class SepticRatsTriggeredAbility extends TriggeredAbilityImpl { return new SepticRatsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId()) ) { + if (event.getSourceId().equals(this.getSourceId()) ) { Player target = game.getPlayer(event.getTargetId()); - if (target != null) - if (target.getCounters().getCount(CounterType.POISON) > 0) + if (target != null) { + if (target.getCounters().getCount(CounterType.POISON) > 0) { return true; + } + } } return false; } diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/SwordOfFeastAndFamine.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/SwordOfFeastAndFamine.java index 238dbe813a..fe1da15692 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/SwordOfFeastAndFamine.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/SwordOfFeastAndFamine.java @@ -29,30 +29,30 @@ package mage.sets.mirrodinbesieged; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.ObjectColor; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.Effect; -import mage.abilities.effects.common.continuous.BoostEquippedEffect; -import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.abilities.effects.common.UntapAllLandsControllerEffect; +import mage.abilities.effects.common.continuous.BoostEquippedEffect; import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.abilities.keyword.EquipAbility; import mage.abilities.keyword.ProtectionAbility; import mage.cards.CardImpl; import mage.constants.AttachmentType; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -106,17 +106,20 @@ class SwordOfFeastAndFamineAbility extends TriggeredAbilityImpl { return new SwordOfFeastAndFamineAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - Permanent p = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - return true; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + Permanent p = game.getPermanent(event.getSourceId()); + if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/ThopterAssembly.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/ThopterAssembly.java index 4de16ffabe..c53527f619 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/ThopterAssembly.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/ThopterAssembly.java @@ -42,6 +42,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.token.Token; /** @@ -99,9 +100,14 @@ class ThopterAssemblyTriggeredAbility extends TriggeredAbilityImpl { return new ThopterAssemblyTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { + if (event.getPlayerId().equals(this.controllerId)) { if (game.getBattlefield().count(filter, this.getSourceId(), this.getControllerId(), game) == 0) { return true; } diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/VirulentWound.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/VirulentWound.java index a653caa783..c214b50e50 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/VirulentWound.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/VirulentWound.java @@ -28,16 +28,16 @@ package mage.sets.mirrodinbesieged; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; @@ -116,9 +116,14 @@ class VirulentWoundDelayedTriggeredAbility extends DelayedTriggeredAbility { this.target = ability.target; } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(target)) { + if (event.getTargetId().equals(target)) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { return true; diff --git a/Mage.Sets/src/mage/sets/modernmasters/AuntiesSnitch.java b/Mage.Sets/src/mage/sets/modernmasters/AuntiesSnitch.java index ac211f2a11..cd4379e7e8 100644 --- a/Mage.Sets/src/mage/sets/modernmasters/AuntiesSnitch.java +++ b/Mage.Sets/src/mage/sets/modernmasters/AuntiesSnitch.java @@ -45,6 +45,7 @@ import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -101,16 +102,16 @@ class AuntiesSnitchTriggeredAbility extends TriggeredAbilityImpl { return new AuntiesSnitchTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - Permanent p = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && p != null && filter.match(p, getSourceId(), getControllerId(), game)) { - return true; - } - } - return false; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + Permanent p = game.getPermanent(event.getSourceId()); + return damageEvent.isCombatDamage() && p != null && filter.match(p, getSourceId(), getControllerId(), game); } @Override diff --git a/Mage.Sets/src/mage/sets/modernmasters/DreamspoilerWitches.java b/Mage.Sets/src/mage/sets/modernmasters/DreamspoilerWitches.java index c20d6f7aad..24b3b74b88 100644 --- a/Mage.Sets/src/mage/sets/modernmasters/DreamspoilerWitches.java +++ b/Mage.Sets/src/mage/sets/modernmasters/DreamspoilerWitches.java @@ -39,6 +39,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCreaturePermanent; /** @@ -89,14 +90,14 @@ class DreamspoilerWitchesTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST - && event.getPlayerId().equals(this.controllerId) - && game.getOpponents(this.controllerId).contains(game.getActivePlayerId())) { - return true; + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } - } - return false; + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return event.getPlayerId().equals(this.controllerId) + && game.getOpponents(this.controllerId).contains(game.getActivePlayerId()); } @Override diff --git a/Mage.Sets/src/mage/sets/modernmasters/TrygonPredator.java b/Mage.Sets/src/mage/sets/modernmasters/TrygonPredator.java index cc72de228c..44d11fc8d9 100644 --- a/Mage.Sets/src/mage/sets/modernmasters/TrygonPredator.java +++ b/Mage.Sets/src/mage/sets/modernmasters/TrygonPredator.java @@ -92,10 +92,14 @@ class TrygonPredatorTriggeredAbility extends TriggeredAbilityImpl { return new TrygonPredatorTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId) - && ((DamagedPlayerEvent) event).isCombatDamage()) { + if (event.getSourceId().equals(this.sourceId) && ((DamagedPlayerEvent) event).isCombatDamage()) { Player player = game.getPlayer(event.getTargetId()); if (player != null) { FilterPermanent filter = new FilterPermanent("an artifact or enchantment controlled by " + player.getLogName()); diff --git a/Mage.Sets/src/mage/sets/morningtide/GreatbowDoyen.java b/Mage.Sets/src/mage/sets/morningtide/GreatbowDoyen.java index ed4882fe4c..eba1fdfac0 100644 --- a/Mage.Sets/src/mage/sets/morningtide/GreatbowDoyen.java +++ b/Mage.Sets/src/mage/sets/morningtide/GreatbowDoyen.java @@ -28,8 +28,6 @@ package mage.sets.morningtide; import java.util.UUID; - -import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -37,11 +35,18 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continuous.BoostAllEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; @@ -99,20 +104,23 @@ class GreatbowDoyenTriggeredAbility extends TriggeredAbilityImpl { return new GreatbowDoyenTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) { - Permanent creature = game.getPermanent(event.getSourceId()); - Permanent damagedCreature = game.getPermanent(event.getTargetId()); - if (creature != null && damagedCreature != null - && creature.getCardType().contains(CardType.CREATURE) - && creature.hasSubtype("Archer") - && creature.getControllerId().equals(controllerId)) { - this.getEffects().get(0).setValue("damageAmount", event.getAmount()); - this.getEffects().get(0).setValue("controller", damagedCreature.getControllerId()); - this.getEffects().get(0).setValue("source", event.getSourceId()); - return true; - } + Permanent creature = game.getPermanent(event.getSourceId()); + Permanent damagedCreature = game.getPermanent(event.getTargetId()); + if (creature != null && damagedCreature != null + && creature.getCardType().contains(CardType.CREATURE) + && creature.hasSubtype("Archer") + && creature.getControllerId().equals(controllerId)) { + this.getEffects().get(0).setValue("damageAmount", event.getAmount()); + this.getEffects().get(0).setValue("controller", damagedCreature.getControllerId()); + this.getEffects().get(0).setValue("source", event.getSourceId()); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java b/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java index 69d1fd40a3..377e70bf95 100644 --- a/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java +++ b/Mage.Sets/src/mage/sets/morningtide/OonasBlackguard.java @@ -148,9 +148,14 @@ class OonasBlackguardTriggeredAbility extends TriggeredAbilityImpl { return new OonasBlackguardTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && ((DamagedPlayerEvent) event).isCombatDamage()) { + if (((DamagedPlayerEvent) event).isCombatDamage()) { Permanent creature = game.getPermanent(event.getSourceId()); if (creature != null && creature.getControllerId().equals(getControllerId()) && creature.getCounters().getCount(CounterType.P1P1) > 0) { for(Effect effect : this.getEffects()) diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ArmWithAEther.java b/Mage.Sets/src/mage/sets/newphyrexia/ArmWithAEther.java index 10810e3a16..ba41a9d2fc 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/ArmWithAEther.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/ArmWithAEther.java @@ -28,19 +28,20 @@ package mage.sets.newphyrexia; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.common.TargetCreaturePermanent; @@ -86,10 +87,15 @@ class ArmWithAEtherTriggeredAbility extends TriggeredAbilityImpl { return new ArmWithAEtherTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { Player opponent = game.getPlayer(event.getPlayerId()); - if (opponent != null && event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId)) { + if (opponent != null && event.getSourceId().equals(this.sourceId)) { FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls"); filter.add(new ControllerIdPredicate(opponent.getId())); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/BlindZealot.java b/Mage.Sets/src/mage/sets/newphyrexia/BlindZealot.java index f160862260..6bee1ff994 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/BlindZealot.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/BlindZealot.java @@ -28,16 +28,16 @@ package mage.sets.newphyrexia; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.IntimidateAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; @@ -93,9 +93,14 @@ class BlindZealotTriggeredAbility extends TriggeredAbilityImpl { return new BlindZealotTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId) + if (event.getSourceId().equals(this.sourceId) && ((DamagedPlayerEvent) event).isCombatDamage()) { Player player = game.getPlayer(this.getControllerId()); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/CagedSun.java b/Mage.Sets/src/mage/sets/newphyrexia/CagedSun.java index e7fdb969e1..08e62f1998 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/CagedSun.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/CagedSun.java @@ -28,33 +28,30 @@ package mage.sets.newphyrexia; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.Mana; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ContinuousEffectImpl; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.ChooseColorEffect; import mage.abilities.effects.common.ManaEffect; import mage.abilities.mana.TriggeredManaAbility; import mage.cards.CardImpl; -import mage.choices.ChoiceColor; +import mage.constants.CardType; import mage.constants.ColoredManaSymbol; +import mage.constants.Duration; import mage.constants.Layer; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.SubLayer; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; -import mage.util.CardUtil; /** * @@ -135,9 +132,14 @@ class CagedSunTriggeredAbility extends TriggeredManaAbility { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.MANA_ADDED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.MANA_ADDED && event.getPlayerId().equals(controllerId)) { + if (event.getPlayerId().equals(controllerId)) { Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); if (permanent != null && permanent.getCardType().contains(CardType.LAND)) { ObjectColor color = (ObjectColor) game.getState().getValue(this.sourceId + "_color"); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheAnnex.java b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheAnnex.java index c68d2b0bd9..cacff52229 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheAnnex.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheAnnex.java @@ -28,9 +28,6 @@ package mage.sets.newphyrexia; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; @@ -41,11 +38,15 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CounterUnlessPaysEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.SetTargetPointer; import mage.constants.Zone; import mage.filter.FilterSpell; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -124,9 +125,14 @@ class ChancellorOfTheAnnexDelayedTriggeredAbility extends DelayedTriggeredAbilit this.playerId = ability.playerId; } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(playerId)) { + if (event.getPlayerId().equals(playerId)) { this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId())); return true; } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheDross.java b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheDross.java index 41747b0780..f91dc4953d 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheDross.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheDross.java @@ -28,9 +28,6 @@ package mage.sets.newphyrexia; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; @@ -39,8 +36,12 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.LifelinkAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -85,12 +86,14 @@ class ChancellorOfTheDrossDelayedTriggeredAbility extends DelayedTriggeredAbilit super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) { - return true; - } - return false; + return true; } @Override public ChancellorOfTheDrossDelayedTriggeredAbility copy() { @@ -115,8 +118,9 @@ class ChancellorOfTheDrossEffect extends OneShotEffect { for (UUID opponentId : game.getOpponents(source.getControllerId())) { loseLife += game.getPlayer(opponentId).loseLife(3, game); } - if (loseLife > 0) + if (loseLife > 0) { game.getPlayer(source.getControllerId()).gainLife(loseLife, game); + } return true; } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheForge.java b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheForge.java index dcd832f67a..581d267015 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheForge.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheForge.java @@ -28,9 +28,6 @@ package mage.sets.newphyrexia; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.TargetController; import mage.MageInt; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.common.ChancellorAbility; @@ -40,10 +37,14 @@ import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.keyword.HasteAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.token.Token; /** @@ -95,12 +96,14 @@ class ChancellorOfTheForgeDelayedTriggeredAbility extends DelayedTriggeredAbilit super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) { - return true; - } - return false; + return true; } @Override public ChancellorOfTheForgeDelayedTriggeredAbility copy() { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheSpires.java b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheSpires.java index 0f7592fde2..1a1c43a3e2 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheSpires.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheSpires.java @@ -28,10 +28,6 @@ package mage.sets.newphyrexia; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; @@ -41,11 +37,16 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.PlayTargetWithoutPayingManaEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.common.TargetCardInOpponentsGraveyard; @@ -103,10 +104,15 @@ class ChancellorOfTheSpiresDelayedTriggeredAbility extends DelayedTriggeredAbili ChancellorOfTheSpiresDelayedTriggeredAbility(ChancellorOfTheSpiresDelayedTriggeredAbility ability) { super(ability); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE; + return true; } @Override public ChancellorOfTheSpiresDelayedTriggeredAbility copy() { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheTangle.java b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheTangle.java index b8634fc399..810a3c9db9 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheTangle.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheTangle.java @@ -28,18 +28,19 @@ package mage.sets.newphyrexia; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.Mana; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.common.ChancellorAbility; import mage.abilities.effects.common.BasicManaEffect; -import mage.abilities.keyword.VigilanceAbility; import mage.abilities.keyword.ReachAbility; +import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -85,12 +86,14 @@ class ChancellorOfTheTangleDelayedTriggeredAbility extends DelayedTriggeredAbili super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.PRECOMBAT_MAIN_PHASE_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.PRECOMBAT_MAIN_PHASE_PRE && game.getActivePlayerId().equals(controllerId)) { - return true; - } - return false; + return game.getActivePlayerId().equals(controllerId); } @Override public ChancellorOfTheTangleDelayedTriggeredAbility copy() { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/InvaderParasite.java b/Mage.Sets/src/mage/sets/newphyrexia/InvaderParasite.java index a4d08f27ef..8e59012537 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/InvaderParasite.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/InvaderParasite.java @@ -28,9 +28,6 @@ package mage.sets.newphyrexia; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -40,10 +37,13 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.common.TargetLandPermanent; import mage.target.targetpointer.FixedTarget; @@ -118,9 +118,14 @@ class InvaderParasiteTriggeredAbility extends TriggeredAbilityImpl { return new InvaderParasiteTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && game.getOpponents(this.controllerId).contains(event.getPlayerId())) { + if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) { Permanent p = game.getPermanent(event.getTargetId()); Permanent sourcePermanent = game.getPermanent(getSourceId()); if (p != null && sourcePermanent != null) { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/KarnLiberated.java b/Mage.Sets/src/mage/sets/newphyrexia/KarnLiberated.java index 09348348fc..38deecc35f 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/KarnLiberated.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/KarnLiberated.java @@ -177,12 +177,14 @@ class KarnLiberatedDelayedTriggeredAbility extends DelayedTriggeredAbility { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BEGINNING_PHASE_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.BEGINNING_PHASE_PRE) { - return true; - } - return false; + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/newphyrexia/NumbingDose.java b/Mage.Sets/src/mage/sets/newphyrexia/NumbingDose.java index 6adb55f68e..b4aad1e529 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/NumbingDose.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/NumbingDose.java @@ -28,23 +28,23 @@ package mage.sets.newphyrexia; import java.util.UUID; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.DontUntapInControllersUntapStepEnchantedEffect; +import mage.abilities.effects.common.LoseLifeTargetEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.common.AttachEffect; -import mage.abilities.effects.common.LoseLifeTargetEffect; -import mage.abilities.effects.common.DontUntapInControllersUntapStepEnchantedEffect; -import mage.abilities.keyword.EnchantAbility; -import mage.cards.CardImpl; import mage.filter.FilterPermanent; -import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.targetpointer.FixedTarget; @@ -107,13 +107,17 @@ class NumbingDoseTriggeredAbility extends TriggeredAbilityImpl { return new NumbingDoseTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent equipment = game.getPermanent(this.getSourceId()); if (equipment != null) { Permanent permanent = game.getPermanent(equipment.getAttachedTo()); - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE - && permanent != null && event.getPlayerId().equals(permanent.getControllerId())) { + if (permanent != null && event.getPlayerId().equals(permanent.getControllerId())) { this.getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getControllerId())); return true; } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianObliterator.java b/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianObliterator.java index 1ad441cca6..5811c99d20 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianObliterator.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianObliterator.java @@ -28,19 +28,19 @@ package mage.sets.newphyrexia; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.common.SacrificeEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -86,9 +86,14 @@ class PhyrexianObliteratorTriggeredAbility extends TriggeredAbilityImpl { return new PhyrexianObliteratorTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId)) { + if (event.getTargetId().equals(this.sourceId)) { UUID controller = game.getControllerId(event.getSourceId()); if (controller != null) { Player player = game.getPlayer(controller); diff --git a/Mage.Sets/src/mage/sets/newphyrexia/PsychicSurgery.java b/Mage.Sets/src/mage/sets/newphyrexia/PsychicSurgery.java index cbe7316723..45073f0eb6 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/PsychicSurgery.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/PsychicSurgery.java @@ -28,10 +28,6 @@ package mage.sets.newphyrexia; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; @@ -39,9 +35,14 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.TargetCard; @@ -84,9 +85,14 @@ class PsychicSurgeryTriggeredAbility extends TriggeredAbilityImpl { return new PsychicSurgeryTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.LIBRARY_SHUFFLED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.LIBRARY_SHUFFLED && game.getOpponents(controllerId).contains(event.getPlayerId())) { + if (game.getOpponents(controllerId).contains(event.getPlayerId())) { this.getEffects().get(0).setValue("PsychicSurgeryOpponent", event.getPlayerId()); return true; } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/RageExtractor.java b/Mage.Sets/src/mage/sets/newphyrexia/RageExtractor.java index 4cb2367ce7..cd3c011410 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/RageExtractor.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/RageExtractor.java @@ -28,19 +28,18 @@ package mage.sets.newphyrexia; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.PhyrexianManaCost; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.common.DamageTargetEffect; -import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.target.common.TargetCreatureOrPlayer; @@ -82,9 +81,14 @@ class RageExtractorTriggeredAbility extends TriggeredAbilityImpl { return new RageExtractorTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(this.controllerId)) { + if (event.getPlayerId().equals(this.controllerId)) { Spell spell = (Spell) game.getStack().getStackObject(event.getTargetId()); if (spell != null) { for (ManaCost cost : spell.getCard().getManaCost()) { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ReaperOfSheoldred.java b/Mage.Sets/src/mage/sets/newphyrexia/ReaperOfSheoldred.java index d4fb7ce5d2..c8da60dba2 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/ReaperOfSheoldred.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/ReaperOfSheoldred.java @@ -28,19 +28,19 @@ package mage.sets.newphyrexia; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.keyword.InfectAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -85,9 +85,14 @@ class ReaperOfSheoldredTriggeredAbility extends TriggeredAbilityImpl { return new ReaperOfSheoldredTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.getSourceId())) { + if (event.getTargetId().equals(this.getSourceId())) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/SuturePriest.java b/Mage.Sets/src/mage/sets/newphyrexia/SuturePriest.java index 68c4380651..73456cb31b 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/SuturePriest.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/SuturePriest.java @@ -29,9 +29,6 @@ package mage.sets.newphyrexia; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility; @@ -40,6 +37,8 @@ import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; @@ -47,6 +46,7 @@ import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -100,9 +100,14 @@ class SuturePriestSecondTriggeredAbility extends TriggeredAbilityImpl { return new SuturePriestSecondTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && game.getOpponents(this.controllerId).contains(event.getPlayerId())) { + if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) { EntersTheBattlefieldEvent zEvent = (EntersTheBattlefieldEvent)event; Card card = zEvent.getTarget(); if (card != null && card.getCardType().contains(CardType.CREATURE)) { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/SwordOfWarAndPeace.java b/Mage.Sets/src/mage/sets/newphyrexia/SwordOfWarAndPeace.java index b75e1b27ef..1bfd7373e8 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/SwordOfWarAndPeace.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/SwordOfWarAndPeace.java @@ -29,12 +29,6 @@ package mage.sets.newphyrexia; import java.util.UUID; - -import mage.constants.AttachmentType; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -49,12 +43,18 @@ import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.EquipAbility; import mage.abilities.keyword.ProtectionAbility; import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPlayer; @@ -119,15 +119,18 @@ class SwordOfWarAndPeaceAbility extends TriggeredAbilityImpl { return new SwordOfWarAndPeaceAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - Permanent p = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { - getTargets().get(0).add(event.getPlayerId(), game); - return true; - } + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + Permanent p = game.getPermanent(event.getSourceId()); + if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { + getTargets().get(0).add(event.getPlayerId(), game); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/newphyrexia/VorinclexVoiceOfHunger.java b/Mage.Sets/src/mage/sets/newphyrexia/VorinclexVoiceOfHunger.java index c89f8dafe3..00d838eea5 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/VorinclexVoiceOfHunger.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/VorinclexVoiceOfHunger.java @@ -43,6 +43,7 @@ import mage.constants.Zone; import mage.filter.common.FilterControlledLandPermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -95,9 +96,14 @@ class VorinclexTriggeredAbility2 extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TAPPED_FOR_MANA && game.getOpponents(controllerId).contains(event.getPlayerId())) { + if (game.getOpponents(controllerId).contains(event.getPlayerId())) { Permanent permanent = game.getPermanent(event.getSourceId()); if (permanent != null && permanent.getCardType().contains(CardType.LAND)) { getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); diff --git a/Mage.Sets/src/mage/sets/ninthedition/Cowardice.java b/Mage.Sets/src/mage/sets/ninthedition/Cowardice.java index 8df3fd58fb..2b7fc3a820 100644 --- a/Mage.Sets/src/mage/sets/ninthedition/Cowardice.java +++ b/Mage.Sets/src/mage/sets/ninthedition/Cowardice.java @@ -28,7 +28,6 @@ package mage.sets.ninthedition; import java.util.UUID; - import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.cards.CardImpl; @@ -37,6 +36,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.stack.StackObject; import mage.target.targetpointer.FixedTarget; @@ -76,15 +76,18 @@ class CowardiceTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TARGETED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (GameEvent.EventType.TARGETED.equals(event.getType())) { - Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && - StackObject.class.isInstance(game.getObject(event.getSourceId()))) { - getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId())); - return true; - } + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && + StackObject.class.isInstance(game.getObject(event.getSourceId()))) { + getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/ninthedition/Deathgazer.java b/Mage.Sets/src/mage/sets/ninthedition/Deathgazer.java index 6bd0b64e1d..68f56668e4 100644 --- a/Mage.Sets/src/mage/sets/ninthedition/Deathgazer.java +++ b/Mage.Sets/src/mage/sets/ninthedition/Deathgazer.java @@ -28,17 +28,17 @@ package mage.sets.ninthedition; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -82,28 +82,29 @@ class DeathgazerTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BLOCKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) { if (event.getSourceId().equals(this.getSourceId())) { - Permanent permanent = game.getPermanent(event.getTargetId()); - if(permanent != null && !permanent.getColor(game).isBlack()) - { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - } - return true; + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent != null && !permanent.getColor(game).isBlack()) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); } + return true; } - if (event.getTargetId().equals(this.getSourceId())) { - Permanent permanent = game.getPermanent(event.getSourceId()); - if(permanent != null && !permanent.getColor(game).isBlack()) - { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getSourceId())); - } - return true; + } + if (event.getTargetId().equals(this.getSourceId())) { + Permanent permanent = game.getPermanent(event.getSourceId()); + if (permanent != null && !permanent.getColor(game).isBlack()) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getSourceId())); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/ninthedition/GravePact.java b/Mage.Sets/src/mage/sets/ninthedition/GravePact.java index 08c949d9b2..c501bccf12 100644 --- a/Mage.Sets/src/mage/sets/ninthedition/GravePact.java +++ b/Mage.Sets/src/mage/sets/ninthedition/GravePact.java @@ -30,16 +30,17 @@ package mage.sets.ninthedition; import java.util.ArrayList; import java.util.List; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -85,10 +86,14 @@ class GravePactTriggeredAbility extends TriggeredAbilityImpl { return new GravePactTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE - && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD + if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (permanent.getControllerId().equals(this.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE)) { diff --git a/Mage.Sets/src/mage/sets/ninthedition/GuerrillaTactics.java b/Mage.Sets/src/mage/sets/ninthedition/GuerrillaTactics.java index 093240dfd8..052be88b5c 100644 --- a/Mage.Sets/src/mage/sets/ninthedition/GuerrillaTactics.java +++ b/Mage.Sets/src/mage/sets/ninthedition/GuerrillaTactics.java @@ -27,7 +27,7 @@ */ package mage.sets.ninthedition; -import mage.MageObject; +import java.util.UUID; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; @@ -36,11 +36,10 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.StackObject; import mage.target.common.TargetCreatureOrPlayer; -import java.util.UUID; - /** * * @author dustinconrad @@ -85,10 +84,14 @@ class GuerrillaTacticsTriggeredAbility extends TriggeredAbilityImpl { return new GuerrillaTacticsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DISCARDED_CARD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return GameEvent.EventType.DISCARDED_CARD.equals(event.getType()) && - game.getOpponents(this.getControllerId()).contains(game.getControllerId(event.getSourceId())) && + return game.getOpponents(this.getControllerId()).contains(game.getControllerId(event.getSourceId())) && StackObject.class.isInstance(game.getObject(event.getSourceId())) && getSourceId().equals(event.getTargetId()); } diff --git a/Mage.Sets/src/mage/sets/ninthedition/ViashinoSandstalker.java b/Mage.Sets/src/mage/sets/ninthedition/ViashinoSandstalker.java index 15daeb3362..e506714d39 100644 --- a/Mage.Sets/src/mage/sets/ninthedition/ViashinoSandstalker.java +++ b/Mage.Sets/src/mage/sets/ninthedition/ViashinoSandstalker.java @@ -28,18 +28,18 @@ package mage.sets.ninthedition; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.ReturnToHandSourceEffect; import mage.abilities.keyword.HasteAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -90,12 +90,14 @@ class BeginningOfEndStepTriggeredAbility extends TriggeredAbilityImpl { return new BeginningOfEndStepTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE) { - return true; - } - return false; + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/odyssey/BattleStrain.java b/Mage.Sets/src/mage/sets/odyssey/BattleStrain.java index 4f11353d94..131fcb69db 100644 --- a/Mage.Sets/src/mage/sets/odyssey/BattleStrain.java +++ b/Mage.Sets/src/mage/sets/odyssey/BattleStrain.java @@ -36,6 +36,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -79,14 +80,17 @@ class BattleStrainTriggeredAbility extends TriggeredAbilityImpl { return new BattleStrainTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BLOCKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) { - Permanent blocker = game.getPermanent(event.getSourceId()); - if (blocker != null) { - getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getControllerId())); - return true; - } + Permanent blocker = game.getPermanent(event.getSourceId()); + if (blocker != null) { + getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getControllerId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/odyssey/BombSquad.java b/Mage.Sets/src/mage/sets/odyssey/BombSquad.java index ece09b89c1..0f370761a0 100644 --- a/Mage.Sets/src/mage/sets/odyssey/BombSquad.java +++ b/Mage.Sets/src/mage/sets/odyssey/BombSquad.java @@ -112,9 +112,14 @@ class BombSquadTriggeredAbility extends TriggeredAbilityImpl { return new BombSquadTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.COUNTER_ADDED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(EventType.COUNTER_ADDED) && event.getData().equals(CounterType.FUSE.getName())) { + if (event.getData().equals(CounterType.FUSE.getName())) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null && filter.match(permanent, game)) { if (4 <= permanent.getCounters().getCount(CounterType.FUSE)) { diff --git a/Mage.Sets/src/mage/sets/odyssey/DecayingSoil.java b/Mage.Sets/src/mage/sets/odyssey/DecayingSoil.java index 4acbfaa5df..5f0b340da9 100644 --- a/Mage.Sets/src/mage/sets/odyssey/DecayingSoil.java +++ b/Mage.Sets/src/mage/sets/odyssey/DecayingSoil.java @@ -53,6 +53,7 @@ import mage.filter.predicate.other.OwnerPredicate; import mage.filter.predicate.permanent.TokenPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -84,9 +85,9 @@ public class DecayingSoil extends CardImpl { // Threshold - As long as seven or more cards are in your graveyard, Decaying Soil has "Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {1}. If you do, return that card to your hand." this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, - new ConditionalContinuousEffect(new GainAbilitySourceEffect(new DecayingSoilTriggeredAbility(new DecayingSoilEffect(), filter)), - new CardsInControllerGraveCondition(7), - "Threshold - As long as seven or more cards are in your graveyard, {this} has \"Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {1}. If you do, return that card to your hand"))); + new ConditionalContinuousEffect(new GainAbilitySourceEffect(new DecayingSoilTriggeredAbility(new DecayingSoilEffect(), filter)), + new CardsInControllerGraveCondition(7), + "Threshold - As long as seven or more cards are in your graveyard, {this} has \"Whenever a nontoken creature is put into your graveyard from the battlefield, you may pay {1}. If you do, return that card to your hand"))); } public DecayingSoil(final DecayingSoil card) { @@ -118,16 +119,19 @@ class DecayingSoilTriggeredAbility extends TriggeredAbilityImpl { return new DecayingSoilTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { - Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (permanent != null && filter.match(permanent, this.getSourceId(), this.getControllerId(), game)) { - getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); - return true; - } + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { + Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + if (permanent != null && filter.match(permanent, this.getSourceId(), this.getControllerId(), game)) { + getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); + return true; } } return false; @@ -136,10 +140,7 @@ class DecayingSoilTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkInterveningIfClause(Game game) { Player controller = game.getPlayer(this.getControllerId()); - if(controller != null && controller.getGraveyard().contains(this.getSourceId())) { - return true; - } - return false; + return controller != null && controller.getGraveyard().contains(this.getSourceId()); } diff --git a/Mage.Sets/src/mage/sets/odyssey/DruidsCall.java b/Mage.Sets/src/mage/sets/odyssey/DruidsCall.java index 68d02ca94e..7746b54f02 100644 --- a/Mage.Sets/src/mage/sets/odyssey/DruidsCall.java +++ b/Mage.Sets/src/mage/sets/odyssey/DruidsCall.java @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.permanent.token.SquirrelToken; import mage.game.permanent.token.Token; @@ -96,16 +97,19 @@ class DruidsCallTriggeredAbility extends TriggeredAbilityImpl { return new DruidsCallTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) { - Permanent enchantment = game.getPermanent(sourceId); - UUID targetId = event.getTargetId(); - if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) { - this.getEffects().get(0).setValue("damageAmount", event.getAmount()); - this.getEffects().get(0).setTargetPointer(new FixedTarget(targetId)); - return true; - } + Permanent enchantment = game.getPermanent(sourceId); + UUID targetId = event.getTargetId(); + if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) { + this.getEffects().get(0).setValue("damageAmount", event.getAmount()); + this.getEffects().get(0).setTargetPointer(new FixedTarget(targetId)); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/odyssey/FilthyCur.java b/Mage.Sets/src/mage/sets/odyssey/FilthyCur.java index cf41b23ce1..c6b8307173 100644 --- a/Mage.Sets/src/mage/sets/odyssey/FilthyCur.java +++ b/Mage.Sets/src/mage/sets/odyssey/FilthyCur.java @@ -38,6 +38,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -83,14 +84,17 @@ class DealtDamageLoseLifeTriggeredAbility extends TriggeredAbilityImpl { return new DealtDamageLoseLifeTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) { - if (event.getTargetId().equals(this.sourceId)) { - this.getEffects().clear(); - this.addEffect(new LoseLifeSourceControllerEffect(event.getAmount())); - return true; - } + if (event.getTargetId().equals(this.sourceId)) { + this.getEffects().clear(); + this.addEffect(new LoseLifeSourceControllerEffect(event.getAmount())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/odyssey/KarmicJustice.java b/Mage.Sets/src/mage/sets/odyssey/KarmicJustice.java index 700b591ffa..5b3978c5bb 100644 --- a/Mage.Sets/src/mage/sets/odyssey/KarmicJustice.java +++ b/Mage.Sets/src/mage/sets/odyssey/KarmicJustice.java @@ -82,10 +82,15 @@ class KarmicJusticeTriggeredAbility extends TriggeredAbilityImpl { public KarmicJusticeTriggeredAbility copy() { return new KarmicJusticeTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DESTROYED_PERMANENT; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DESTROYED_PERMANENT && event.getPlayerId().equals(controllerId) + if (event.getPlayerId().equals(controllerId) && game.getOpponents(this.getControllerId()).contains(game.getControllerId(event.getSourceId()))) { MageObject mageObject = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (!mageObject.getCardType().contains(CardType.CREATURE)) { diff --git a/Mage.Sets/src/mage/sets/odyssey/PriceOfGlory.java b/Mage.Sets/src/mage/sets/odyssey/PriceOfGlory.java index 3d5b5cfc7c..2e372d71a3 100644 --- a/Mage.Sets/src/mage/sets/odyssey/PriceOfGlory.java +++ b/Mage.Sets/src/mage/sets/odyssey/PriceOfGlory.java @@ -38,6 +38,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -79,18 +80,21 @@ class PriceOfGloryAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TAPPED_FOR_MANA) { - Permanent permanent = game.getPermanent(event.getSourceId()); - if (permanent == null) { - permanent = (Permanent) game.getLastKnownInformation(event.getSourceId(), Zone.BATTLEFIELD); - } - if (permanent != null && permanent.getCardType().contains(CardType.LAND) - && !permanent.getControllerId().equals(game.getActivePlayerId())) { // intervening if clause - getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); - return true; - } + Permanent permanent = game.getPermanent(event.getSourceId()); + if (permanent == null) { + permanent = (Permanent) game.getLastKnownInformation(event.getSourceId(), Zone.BATTLEFIELD); + } + if (permanent != null && permanent.getCardType().contains(CardType.LAND) + && !permanent.getControllerId().equals(game.getActivePlayerId())) { // intervening if clause + getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/odyssey/SavageFirecat.java b/Mage.Sets/src/mage/sets/odyssey/SavageFirecat.java index 4369d8ec24..2d74fc979d 100644 --- a/Mage.Sets/src/mage/sets/odyssey/SavageFirecat.java +++ b/Mage.Sets/src/mage/sets/odyssey/SavageFirecat.java @@ -93,19 +93,20 @@ class SavageFirecatTriggeredAbility extends TriggeredAbilityImpl { return new SavageFirecatTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.TAPPED_FOR_MANA && - game.getCard(event.getSourceId()).getCardType().contains(CardType.LAND) && - event.getPlayerId().equals(this.controllerId)){ - return true; - } - return false; -} + return game.getCard(event.getSourceId()).getCardType().contains(CardType.LAND) && + event.getPlayerId().equals(this.controllerId); + } @Override public String getRule() { return "Whenever you tap a land for mana, remove a +1/+1 counter from {this}"; -} + } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/odyssey/SparkMage.java b/Mage.Sets/src/mage/sets/odyssey/SparkMage.java index 9b4db2dd7e..817b344622 100644 --- a/Mage.Sets/src/mage/sets/odyssey/SparkMage.java +++ b/Mage.Sets/src/mage/sets/odyssey/SparkMage.java @@ -40,6 +40,7 @@ import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.common.TargetCreaturePermanent; @@ -74,41 +75,44 @@ public class SparkMage extends CardImpl { class SparkMageTriggeredAbility extends TriggeredAbilityImpl { - public SparkMageTriggeredAbility(){ + public SparkMageTriggeredAbility() { super(Zone.BATTLEFIELD, new DamageTargetEffect(1)); this.addTarget(new TargetCreaturePermanent()); } - + public SparkMageTriggeredAbility(final SparkMageTriggeredAbility ability) { super(ability); } - -@Override + + @Override public SparkMageTriggeredAbility copy() { return new SparkMageTriggeredAbility(this); } -@Override + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())){ - Player opponent = game.getPlayer(event.getPlayerId()); - if (opponent != null) { - FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls"); - filter.add(new ControllerIdPredicate(opponent.getId())); - this.getTargets().clear(); - this.getTargets().add(new TargetCreaturePermanent(filter)); - return true; - } + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) { + Player opponent = game.getPlayer(event.getPlayerId()); + if (opponent != null) { + FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls"); + filter.add(new ControllerIdPredicate(opponent.getId())); + this.getTargets().clear(); + this.getTargets().add(new TargetCreaturePermanent(filter)); + return true; } } return false; } -@Override + @Override public String getRule() { return "Whenever {this} deals combat damage to a player, you may have {this} deal 1 damage to target creature that player controls."; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/odyssey/Spiritualize.java b/Mage.Sets/src/mage/sets/odyssey/Spiritualize.java index f13eb6d123..d18b15eebb 100644 --- a/Mage.Sets/src/mage/sets/odyssey/Spiritualize.java +++ b/Mage.Sets/src/mage/sets/odyssey/Spiritualize.java @@ -41,6 +41,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCreaturePermanent; @@ -88,18 +89,21 @@ class SpiritualizeTriggeredAbility extends DelayedTriggeredAbility { return new SpiritualizeTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER + || event.getType() == EventType.DAMAGED_CREATURE + || event.getType() == EventType.DAMAGED_PLANESWALKER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(GameEvent.EventType.DAMAGED_CREATURE) - || event.getType().equals(GameEvent.EventType.DAMAGED_PLAYER) - || event.getType().equals(GameEvent.EventType.DAMAGED_PLANESWALKER)) { - Permanent target = game.getPermanent(this.getFirstTarget()); - if (target != null && event.getSourceId().equals(target.getId())) { - for (Effect effect : this.getEffects()) { - effect.setValue("damage", event.getAmount()); - } - return true; + Permanent target = game.getPermanent(this.getFirstTarget()); + if (target != null && event.getSourceId().equals(target.getId())) { + for (Effect effect : this.getEffects()) { + effect.setValue("damage", event.getAmount()); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/odyssey/Standstill.java b/Mage.Sets/src/mage/sets/odyssey/Standstill.java index 9cc4fa20b2..58472b1bce 100644 --- a/Mage.Sets/src/mage/sets/odyssey/Standstill.java +++ b/Mage.Sets/src/mage/sets/odyssey/Standstill.java @@ -38,6 +38,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -77,13 +78,15 @@ class SpellCastTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); - return true; - } - return false; + this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/onslaught/FalseCure.java b/Mage.Sets/src/mage/sets/onslaught/FalseCure.java index 5b5f4cf122..baa02d6fbf 100644 --- a/Mage.Sets/src/mage/sets/onslaught/FalseCure.java +++ b/Mage.Sets/src/mage/sets/onslaught/FalseCure.java @@ -80,17 +80,19 @@ class FalseCureTriggeredAbility extends DelayedTriggeredAbility { public FalseCureTriggeredAbility copy() { return new FalseCureTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.GAINED_LIFE; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.GAINED_LIFE) { - this.getEffects().clear(); - Effect effect = new LoseLifeTargetEffect(2 * event.getAmount()); - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - this.addEffect(effect); - return true; - } - return false; + this.getEffects().clear(); + Effect effect = new LoseLifeTargetEffect(2 * event.getAmount()); + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + this.addEffect(effect); + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/planarchaos/BenalishCommander.java b/Mage.Sets/src/mage/sets/planarchaos/BenalishCommander.java index b19067af0b..63b9a0f147 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/BenalishCommander.java +++ b/Mage.Sets/src/mage/sets/planarchaos/BenalishCommander.java @@ -105,9 +105,14 @@ class BenalishCommanderTriggeredAbility extends TriggeredAbilityImpl { return new BenalishCommanderTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.COUNTER_REMOVED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return EventType.COUNTER_REMOVED.equals(event.getType()) && event.getData().equals(CounterType.TIME.getName()) && event.getTargetId().equals(this.getSourceId()); + return event.getData().equals(CounterType.TIME.getName()) && event.getTargetId().equals(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/planarchaos/Detritivore.java b/Mage.Sets/src/mage/sets/planarchaos/Detritivore.java index 49abf2bda3..bfa18d8ca8 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/Detritivore.java +++ b/Mage.Sets/src/mage/sets/planarchaos/Detritivore.java @@ -47,7 +47,6 @@ import mage.counters.CounterType; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.filter.predicate.mageobject.NamePredicate; import mage.filter.predicate.mageobject.SupertypePredicate; import mage.game.Game; import mage.game.events.GameEvent; @@ -106,9 +105,14 @@ class DetritivoreTriggeredAbility extends TriggeredAbilityImpl { return new DetritivoreTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.COUNTER_REMOVED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return EventType.COUNTER_REMOVED.equals(event.getType()) && event.getData().equals(CounterType.TIME.getName()) && event.getTargetId().equals(this.getSourceId()); + return event.getData().equals(CounterType.TIME.getName()) && event.getTargetId().equals(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/planarchaos/FungalBehemoth.java b/Mage.Sets/src/mage/sets/planarchaos/FungalBehemoth.java index 9ed7ce665b..7317d947f4 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/FungalBehemoth.java +++ b/Mage.Sets/src/mage/sets/planarchaos/FungalBehemoth.java @@ -100,9 +100,14 @@ class FungalBehemothTriggeredAbility extends TriggeredAbilityImpl { return new FungalBehemothTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.COUNTER_REMOVED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return EventType.COUNTER_REMOVED.equals(event.getType()) && event.getData().equals(CounterType.TIME.getName()) && event.getTargetId().equals(this.getSourceId()); + return event.getData().equals(CounterType.TIME.getName()) && event.getTargetId().equals(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/planarchaos/RoilingHorror.java b/Mage.Sets/src/mage/sets/planarchaos/RoilingHorror.java index ebb54e10c3..7330a1cdcb 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/RoilingHorror.java +++ b/Mage.Sets/src/mage/sets/planarchaos/RoilingHorror.java @@ -105,9 +105,14 @@ class RoilingHorrorTriggeredAbility extends TriggeredAbilityImpl { return new RoilingHorrorTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.COUNTER_REMOVED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return EventType.COUNTER_REMOVED.equals(event.getType()) && event.getData().equals(CounterType.TIME.getName()) && event.getTargetId().equals(this.getSourceId()); + return event.getData().equals(CounterType.TIME.getName()) && event.getTargetId().equals(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/planechase2012/PollenbrightWings.java b/Mage.Sets/src/mage/sets/planechase2012/PollenbrightWings.java index d97462eb7e..77459d9cf1 100644 --- a/Mage.Sets/src/mage/sets/planechase2012/PollenbrightWings.java +++ b/Mage.Sets/src/mage/sets/planechase2012/PollenbrightWings.java @@ -28,13 +28,6 @@ package mage.sets.planechase2012; import java.util.UUID; - -import mage.constants.AttachmentType; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; @@ -46,9 +39,16 @@ import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.permanent.token.SaprolingToken; import mage.target.TargetPermanent; @@ -104,15 +104,18 @@ class PollenbrightWingsAbility extends TriggeredAbilityImpl { return new PollenbrightWingsAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - Permanent p = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { - game.getState().setValue(new StringBuilder("Damage_").append(getSourceId().toString()).toString(), new Integer(damageEvent.getAmount())); - return true; - } + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + Permanent p = game.getPermanent(event.getSourceId()); + if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { + game.getState().setValue(new StringBuilder("Damage_").append(getSourceId().toString()).toString(), new Integer(damageEvent.getAmount())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/planeshift/PhyrexianTyranny.java b/Mage.Sets/src/mage/sets/planeshift/PhyrexianTyranny.java index b52321f3e0..d9f60ea27f 100644 --- a/Mage.Sets/src/mage/sets/planeshift/PhyrexianTyranny.java +++ b/Mage.Sets/src/mage/sets/planeshift/PhyrexianTyranny.java @@ -41,6 +41,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -83,18 +84,20 @@ class PhyrexianTyrannyTriggeredAbility extends TriggeredAbilityImpl { public PhyrexianTyrannyTriggeredAbility copy() { return new PhyrexianTyrannyTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DREW_CARD; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DREW_CARD) { - for (Effect effect : this.getEffects()) { - if (effect instanceof PhyrexianTyrannyEffect) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } + for (Effect effect : this.getEffects()) { + if (effect instanceof PhyrexianTyrannyEffect) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } - return true; } - return false; + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/ravnica/BelltowerSphinx.java b/Mage.Sets/src/mage/sets/ravnica/BelltowerSphinx.java index 1815f45eda..20480a867c 100644 --- a/Mage.Sets/src/mage/sets/ravnica/BelltowerSphinx.java +++ b/Mage.Sets/src/mage/sets/ravnica/BelltowerSphinx.java @@ -27,22 +27,22 @@ */ package mage.sets.ravnica; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.targetpointer.FixedTarget; -import java.util.UUID; - /** * @author nantuko */ @@ -86,9 +86,14 @@ class BelltowerSphinxEffect extends TriggeredAbilityImpl { return new BelltowerSphinxEffect(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId)) { + if (event.getTargetId().equals(this.sourceId)) { UUID controller = game.getControllerId(event.getSourceId()); if (controller != null) { Player player = game.getPlayer(controller); diff --git a/Mage.Sets/src/mage/sets/ravnica/BreathOfFury.java b/Mage.Sets/src/mage/sets/ravnica/BreathOfFury.java index fd5d9b3915..26741f9e70 100644 --- a/Mage.Sets/src/mage/sets/ravnica/BreathOfFury.java +++ b/Mage.Sets/src/mage/sets/ravnica/BreathOfFury.java @@ -28,29 +28,30 @@ package mage.sets.ravnica; import java.util.UUID; -import mage.cards.CardImpl; -import mage.constants.Rarity; -import mage.constants.CardType; -import mage.target.TargetPermanent; -import mage.target.common.TargetControlledCreaturePermanent; -import mage.abilities.effects.common.AttachEffect; -import mage.constants.Outcome; import mage.abilities.Ability; -import mage.abilities.keyword.EnchantAbility; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TurnPhase; import mage.constants.Zone; -import mage.game.events.GameEvent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.CanBeEnchantedByPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; -import mage.abilities.effects.OneShotEffect; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; +import mage.game.turn.TurnMod; import mage.players.Player; import mage.target.Target; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.game.turn.TurnMod; -import mage.constants.TurnPhase; -import mage.filter.predicate.permanent.CanBeEnchantedByPredicate; +import mage.target.TargetPermanent; +import mage.target.common.TargetControlledCreaturePermanent; /** * @author duncant */ @@ -96,21 +97,24 @@ class BreathOfFuryAbility extends TriggeredAbilityImpl { return new BreathOfFuryAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - Permanent enchantment = game.getPermanent(getSourceId()); - if (damageEvent.isCombatDamage() && - enchantment != null && - enchantment.getAttachedTo().equals(event.getSourceId())) { - Permanent creature = game.getPermanent(enchantment.getAttachedTo()); - if (creature != null) { - for (Effect effect : getEffects()) { - effect.setValue("TriggeringCreatureId", creature.getId()); - } - return true; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + Permanent enchantment = game.getPermanent(getSourceId()); + if (damageEvent.isCombatDamage() && + enchantment != null && + enchantment.getAttachedTo().equals(event.getSourceId())) { + Permanent creature = game.getPermanent(enchantment.getAttachedTo()); + if (creature != null) { + for (Effect effect : getEffects()) { + effect.setValue("TriggeringCreatureId", creature.getId()); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/ravnica/TwilightDrover.java b/Mage.Sets/src/mage/sets/ravnica/TwilightDrover.java index a3790504e3..8b31778fb0 100644 --- a/Mage.Sets/src/mage/sets/ravnica/TwilightDrover.java +++ b/Mage.Sets/src/mage/sets/ravnica/TwilightDrover.java @@ -43,6 +43,7 @@ import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.game.permanent.PermanentToken; @@ -95,17 +96,20 @@ class TwilightDroverTriggeredAbility extends TriggeredAbilityImpl { public TwilightDroverTriggeredAbility copy() { return new TwilightDroverTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getFromZone() == Zone.BATTLEFIELD) { - UUID targetId = event.getTargetId(); - Permanent permanent = game.getPermanentOrLKIBattlefield(targetId); - if (permanent != null) { - return permanent.getCardType().contains(CardType.CREATURE) && permanent instanceof PermanentToken; - } + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone() == Zone.BATTLEFIELD) { + UUID targetId = event.getTargetId(); + Permanent permanent = game.getPermanentOrLKIBattlefield(targetId); + if (permanent != null) { + return permanent.getCardType().contains(CardType.CREATURE) && permanent instanceof PermanentToken; } } return false; diff --git a/Mage.Sets/src/mage/sets/returntoravnica/AshZealot.java b/Mage.Sets/src/mage/sets/returntoravnica/AshZealot.java index b6aa841b69..0540913d9b 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/AshZealot.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/AshZealot.java @@ -29,9 +29,6 @@ package mage.sets.returntoravnica; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; @@ -39,9 +36,12 @@ import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.HasteAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.target.targetpointer.FixedTarget; @@ -96,9 +96,14 @@ class AshZealotTriggeredAbility extends TriggeredAbilityImpl { return new AshZealotTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.GRAVEYARD) { + if (event.getZone() == Zone.GRAVEYARD) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null) { for (Effect effect : this.getEffects()) { diff --git a/Mage.Sets/src/mage/sets/returntoravnica/AzorsElocutors.java b/Mage.Sets/src/mage/sets/returntoravnica/AzorsElocutors.java index a70782eca8..040d082291 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/AzorsElocutors.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/AzorsElocutors.java @@ -28,12 +28,6 @@ package mage.sets.returntoravnica; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Outcome; -import mage.constants.TargetController; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -41,9 +35,15 @@ import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.counter.RemoveCounterSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; import mage.counters.Counter; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; @@ -96,12 +96,14 @@ class AzorsElocutorsTriggeredAbility extends TriggeredAbilityImpl { return new AzorsElocutorsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getTargetId().equals(this.controllerId)) { - return true; - } - return false; + return event.getTargetId().equals(this.controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/returntoravnica/ChronicFlooding.java b/Mage.Sets/src/mage/sets/returntoravnica/ChronicFlooding.java index fb6f584b6c..e09ca773fc 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/ChronicFlooding.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/ChronicFlooding.java @@ -29,9 +29,6 @@ package mage.sets.returntoravnica; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; @@ -39,10 +36,13 @@ import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; @@ -89,20 +89,23 @@ class ChronicFloodingAbility extends TriggeredAbilityImpl { ChronicFloodingAbility(final ChronicFloodingAbility ability) { super(ability); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TAPPED) { - Permanent source = game.getPermanent(this.sourceId); - if (source != null && source.getAttachedTo().equals(event.getTargetId())) { - Permanent attached = game.getPermanent(source.getAttachedTo()); - if (attached != null) { - - for (Effect e : getEffects()) { - e.setTargetPointer(new FixedTarget(attached.getControllerId())); - } - return true; + Permanent source = game.getPermanent(this.sourceId); + if (source != null && source.getAttachedTo().equals(event.getTargetId())) { + Permanent attached = game.getPermanent(source.getAttachedTo()); + if (attached != null) { + + for (Effect e : getEffects()) { + e.setTargetPointer(new FixedTarget(attached.getControllerId())); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/returntoravnica/CrosstownCourier.java b/Mage.Sets/src/mage/sets/returntoravnica/CrosstownCourier.java index 340ece5249..aec0e7eb0f 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/CrosstownCourier.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/CrosstownCourier.java @@ -28,19 +28,19 @@ package mage.sets.returntoravnica; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.Effect; import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -85,11 +85,15 @@ public class CrosstownCourier extends CardImpl { return new CrosstownCourierTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId) - && ((DamagedPlayerEvent) event).isCombatDamage()) { - for (Effect effect:getEffects()) { + if (event.getSourceId().equals(this.sourceId) && ((DamagedPlayerEvent) event).isCombatDamage()) { + for (Effect effect : getEffects()) { if (effect instanceof PutLibraryIntoGraveTargetEffect) { effect.setTargetPointer(new FixedTarget(event.getTargetId())); ((PutLibraryIntoGraveTargetEffect) effect).setAmount(new StaticValue(event.getAmount())); diff --git a/Mage.Sets/src/mage/sets/returntoravnica/DeathsPresence.java b/Mage.Sets/src/mage/sets/returntoravnica/DeathsPresence.java index 32601942dd..86ef17515c 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/DeathsPresence.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/DeathsPresence.java @@ -29,16 +29,16 @@ package mage.sets.returntoravnica; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.target.common.TargetControlledCreaturePermanent; @@ -83,10 +83,14 @@ class DeathsPresenceTriggeredAbility extends TriggeredAbilityImpl { return new DeathsPresenceTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE - && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD + if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (permanent != null && permanent.getControllerId().equals(this.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE)) { diff --git a/Mage.Sets/src/mage/sets/returntoravnica/GraveBetrayal.java b/Mage.Sets/src/mage/sets/returntoravnica/GraveBetrayal.java index c83780397b..d28418b909 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/GraveBetrayal.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/GraveBetrayal.java @@ -29,11 +29,6 @@ package mage.sets.returntoravnica; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.TriggeredAbilityImpl; @@ -44,12 +39,17 @@ import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; import mage.constants.Layer; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.SubLayer; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -97,10 +97,14 @@ class GraveBetrayalTriggeredAbility extends TriggeredAbilityImpl { return new GraveBetrayalTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE - && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD + if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (permanent != null && !permanent.getControllerId().equals(this.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE)) { diff --git a/Mage.Sets/src/mage/sets/returntoravnica/JaceArchitectOfThought.java b/Mage.Sets/src/mage/sets/returntoravnica/JaceArchitectOfThought.java index ece1c64a99..c0638aed10 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/JaceArchitectOfThought.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/JaceArchitectOfThought.java @@ -31,19 +31,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.PhaseStep; -import mage.constants.Rarity; -import mage.constants.SubLayer; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.LoyaltyAbility; import mage.abilities.common.EntersBattlefieldAbility; -import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; @@ -53,14 +44,19 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.FilterCard; import mage.filter.common.FilterNonlandCard; import mage.game.ExileZone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; -import mage.game.turn.Step; import mage.players.Player; import mage.target.TargetCard; import mage.target.common.TargetCardInExile; @@ -118,15 +114,18 @@ class JaceArchitectOfThoughtDelayedTriggeredAbility extends DelayedTriggeredAbil super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) { - if (game.getOpponents(getControllerId()).contains(event.getPlayerId())) { - for (Effect effect : getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getSourceId())); - } - return true; + if (game.getOpponents(getControllerId()).contains(event.getPlayerId())) { + for (Effect effect : getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getSourceId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/returntoravnica/LobberCrew.java b/Mage.Sets/src/mage/sets/returntoravnica/LobberCrew.java index 74623e0cfb..570c89917f 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/LobberCrew.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/LobberCrew.java @@ -29,11 +29,6 @@ package mage.sets.returntoravnica; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.TargetController; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleActivatedAbility; @@ -42,8 +37,13 @@ import mage.abilities.effects.common.DamagePlayersEffect; import mage.abilities.effects.common.UntapSourceEffect; import mage.abilities.keyword.DefenderAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; /** @@ -93,13 +93,16 @@ class LobberCrewTriggeredAbility extends TriggeredAbilityImpl { return new LobberCrewTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).isMulticolored() && event.getPlayerId().equals(getControllerId())) { - return true; - } + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null && spell.getColor(game).isMulticolored() && event.getPlayerId().equals(getControllerId())) { + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/returntoravnica/NecropolisRegent.java b/Mage.Sets/src/mage/sets/returntoravnica/NecropolisRegent.java index 3cdce46132..9982076c19 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/NecropolisRegent.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/NecropolisRegent.java @@ -28,9 +28,6 @@ package mage.sets.returntoravnica; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; @@ -38,11 +35,14 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -93,18 +93,21 @@ class NecropolisRegentTriggeredAbility extends TriggeredAbilityImpl { return new NecropolisRegentTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { - if (((DamagedPlayerEvent) event).isCombatDamage()) { - Permanent creature = game.getPermanent(event.getSourceId()); - if (creature != null && creature.getControllerId().equals(controllerId)) { - this.getEffects().clear(); - Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(event.getAmount())); - effect.setTargetPointer(new FixedTarget(creature.getId())); - this.addEffect(effect); - return true; - } + if (((DamagedPlayerEvent) event).isCombatDamage()) { + Permanent creature = game.getPermanent(event.getSourceId()); + if (creature != null && creature.getControllerId().equals(controllerId)) { + this.getEffects().clear(); + Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(event.getAmount())); + effect.setTargetPointer(new FixedTarget(creature.getId())); + this.addEffect(effect); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/returntoravnica/Pyroconvergence.java b/Mage.Sets/src/mage/sets/returntoravnica/Pyroconvergence.java index 1bbf63022c..a001e95d09 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/Pyroconvergence.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/Pyroconvergence.java @@ -29,15 +29,15 @@ package mage.sets.returntoravnica; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.target.common.TargetCreatureOrPlayer; @@ -81,15 +81,15 @@ class PyroconvergenceTriggeredAbility extends TriggeredAbilityImpl { return new PyroconvergenceTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).isMulticolored() && event.getPlayerId().equals(getControllerId())) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getColor(game).isMulticolored() && event.getPlayerId().equals(getControllerId()); } @Override diff --git a/Mage.Sets/src/mage/sets/returntoravnica/SearchTheCity.java b/Mage.Sets/src/mage/sets/returntoravnica/SearchTheCity.java index 3032bf26c3..1d0e8b0be5 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/SearchTheCity.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/SearchTheCity.java @@ -28,22 +28,22 @@ package mage.sets.returntoravnica; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.NamePredicate; import mage.game.ExileZone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.stack.Spell; import mage.game.turn.TurnMod; @@ -125,10 +125,14 @@ class SearchTheCityTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST || event.getType() == EventType.LAND_PLAYED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if ((event.getType() == GameEvent.EventType.SPELL_CAST || event.getType() == GameEvent.EventType.LAND_PLAYED) - && event.getPlayerId().equals(this.getControllerId())) { + if (event.getPlayerId().equals(this.getControllerId())) { String cardName = ""; if (event.getType() == GameEvent.EventType.SPELL_CAST) { Spell spell = game.getStack().getSpell(event.getTargetId()); diff --git a/Mage.Sets/src/mage/sets/returntoravnica/ShriekingAffliction.java b/Mage.Sets/src/mage/sets/returntoravnica/ShriekingAffliction.java index fc91274ff3..71d8f32364 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/ShriekingAffliction.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/ShriekingAffliction.java @@ -29,17 +29,17 @@ package mage.sets.returntoravnica; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -93,9 +93,14 @@ class ShriekingAfflictionTriggeredAbility extends TriggeredAbilityImpl { return new ShriekingAfflictionTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && game.getOpponents(controllerId).contains(event.getPlayerId())) { + if (game.getOpponents(controllerId).contains(event.getPlayerId())) { Player player = game.getPlayer(event.getPlayerId()); if (player != null && player.getHand().size() < 2) { this.getEffects().clear(); diff --git a/Mage.Sets/src/mage/sets/returntoravnica/SkymarkRoc.java b/Mage.Sets/src/mage/sets/returntoravnica/SkymarkRoc.java index 48f58783b3..68a9d768ce 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/SkymarkRoc.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/SkymarkRoc.java @@ -29,14 +29,13 @@ package mage.sets.returntoravnica; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.Filter; import mage.filter.common.FilterCreaturePermanent; @@ -44,6 +43,7 @@ import mage.filter.predicate.mageobject.ToughnessPredicate; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCreaturePermanent; /** @@ -87,9 +87,14 @@ class SkymarkRocAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { + if (event.getSourceId().equals(this.getSourceId())) { FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls with toughness 2 or less"); UUID defenderId = game.getCombat().getDefendingPlayerId(sourceId, game); filter.add(new ControllerIdPredicate(defenderId)); diff --git a/Mage.Sets/src/mage/sets/returntoravnica/TrostaniSelesnyasVoice.java b/Mage.Sets/src/mage/sets/returntoravnica/TrostaniSelesnyasVoice.java index 4a89055ee6..18db391510 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/TrostaniSelesnyasVoice.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/TrostaniSelesnyasVoice.java @@ -29,7 +29,6 @@ package mage.sets.returntoravnica; import java.util.UUID; -import static javax.xml.bind.JAXBIntrospector.getValue; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -46,6 +45,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; @@ -93,19 +93,22 @@ class TrostaniSelesnyasVoiceTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent.getCardType().contains(CardType.CREATURE) - && permanent.getControllerId().equals(this.controllerId) - && event.getTargetId() != this.getSourceId()) { - Effect effect = this.getEffects().get(0); - // life is determined during resolution so it has to be retrieved there (e.g. Giant Growth before resolution) - effect.setValue("lifeSource", event.getTargetId()); - effect.setValue("zoneChangeCounter", permanent.getZoneChangeCounter(game)); - return true; - } + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent.getCardType().contains(CardType.CREATURE) + && permanent.getControllerId().equals(this.controllerId) + && event.getTargetId() != this.getSourceId()) { + Effect effect = this.getEffects().get(0); + // life is determined during resolution so it has to be retrieved there (e.g. Giant Growth before resolution) + effect.setValue("lifeSource", event.getTargetId()); + effect.setValue("zoneChangeCounter", permanent.getZoneChangeCounter(game)); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/returntoravnica/VolatileRig.java b/Mage.Sets/src/mage/sets/returntoravnica/VolatileRig.java index 7b599f6b00..cc804adcfa 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/VolatileRig.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/VolatileRig.java @@ -29,11 +29,6 @@ package mage.sets.returntoravnica; import java.util.List; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -42,7 +37,11 @@ import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; import mage.constants.PhaseStep; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; @@ -107,6 +106,12 @@ class VolatileRigTriggeredAbility extends TriggeredAbilityImpl { return new VolatileRigTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.COMBAT_DAMAGE_STEP_POST + || event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { /* diff --git a/Mage.Sets/src/mage/sets/returntoravnica/VraskaTheUnseen.java b/Mage.Sets/src/mage/sets/returntoravnica/VraskaTheUnseen.java index 8ba32e31cf..e04c58658c 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/VraskaTheUnseen.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/VraskaTheUnseen.java @@ -28,11 +28,6 @@ package mage.sets.returntoravnica; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.*; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; @@ -46,13 +41,20 @@ import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.LoseGameTargetPlayerEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SubLayer; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.DamagedPlaneswalkerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.permanent.token.Token; -import mage.game.turn.Step; import mage.target.common.TargetNonlandPermanent; import mage.target.targetpointer.FixedTarget; @@ -178,9 +180,13 @@ class VraskaTheUnseenTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER && ((DamagedPlaneswalkerEvent) event).isCombatDamage() && event.getTargetId() == sourceId) { + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLANESWALKER; + } + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (((DamagedPlaneswalkerEvent) event).isCombatDamage() && event.getTargetId() == sourceId) { Permanent sourceOfDamage = game.getPermanent(event.getSourceId()); if (sourceOfDamage != null && sourceOfDamage.getCardType().contains(CardType.CREATURE)) { Effect effect = this.getEffects().get(0); diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/AngelheartVial.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/AngelheartVial.java index 636e9e8de8..f7fb2a5a09 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/AngelheartVial.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/AngelheartVial.java @@ -28,24 +28,24 @@ package mage.sets.riseoftheeldrazi; import java.util.UUID; - -import mage.constants.Outcome; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.RemoveCountersSourceCost; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; -import mage.game.Game; import mage.counters.CounterType; +import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -94,12 +94,17 @@ class AngelheartVialTriggeredAbility extends TriggeredAbilityImpl { return new AngelheartVialTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if ((event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getTargetId().equals(this.getControllerId()))) { - this.getEffects().get(0).setValue("damageAmount", event.getAmount()); - return true; - } + if (event.getTargetId().equals(this.getControllerId())) { + this.getEffects().get(0).setValue("damageAmount", event.getAmount()); + return true; + } return false; } diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/BanefulOmen.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/BanefulOmen.java index e8dbc4fd6d..cc5dbffc11 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/BanefulOmen.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/BanefulOmen.java @@ -27,22 +27,23 @@ */ package mage.sets.riseoftheeldrazi; +import java.util.Set; import java.util.UUID; -import mage.constants.Zone; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.cards.CardImpl; -import mage.abilities.TriggeredAbilityImpl; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.abilities.effects.OneShotEffect; -import mage.constants.Outcome; import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.OneShotEffect; import mage.cards.Card; +import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; -import java.util.Set; /** * @@ -83,12 +84,14 @@ public class BanefulOmen extends CardImpl { return new BanefulOmenTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { - return true; - } - return false; + return event.getPlayerId().equals(this.controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/ContaminatedGround.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/ContaminatedGround.java index 854f741966..98dbcb72f8 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/ContaminatedGround.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/ContaminatedGround.java @@ -28,10 +28,6 @@ package mage.sets.riseoftheeldrazi; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; @@ -41,8 +37,13 @@ import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.continuous.BecomesBasicLandEnchantedEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; @@ -93,18 +94,21 @@ class ContaminatedGroundAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TAPPED) { - Permanent source = game.getPermanent(this.sourceId); - if (source != null && source.getAttachedTo().equals(event.getTargetId())) { - Permanent attached = game.getPermanent(source.getAttachedTo()); - if (attached != null) { + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED; + } - for (Effect e : getEffects()) { - e.setTargetPointer(new FixedTarget(attached.getControllerId())); - } - return true; + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent source = game.getPermanent(this.sourceId); + if (source != null && source.getAttachedTo().equals(event.getTargetId())) { + Permanent attached = game.getPermanent(source.getAttachedTo()); + if (attached != null) { + + for (Effect e : getEffects()) { + e.setTargetPointer(new FixedTarget(attached.getControllerId())); } + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/CurseOfWizardry.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/CurseOfWizardry.java index e91deb95bb..bd4d6e4b53 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/CurseOfWizardry.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/CurseOfWizardry.java @@ -27,8 +27,7 @@ */ package mage.sets.riseoftheeldrazi; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -37,17 +36,18 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.cards.CardImpl; import mage.choices.ChoiceColor; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.stack.Spell; import mage.players.Player; import mage.target.targetpointer.FixedTarget; -import java.util.UUID; - /** * @author jeffwadsworth */ @@ -123,18 +123,21 @@ class CurseOfWizardryPlayerCastsSpellChosenColorTriggeredAbility extends Trigger return new CurseOfWizardryPlayerCastsSpellChosenColorTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent curseOfWizardry = game.getPermanent(getSourceId()); if (curseOfWizardry != null) { ObjectColor chosenColor = (ObjectColor) game.getState().getValue(curseOfWizardry.getId() + "_color"); if (chosenColor != null) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).shares(chosenColor)) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); - return true; - } + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null && spell.getColor(game).shares(chosenColor)) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); + return true; } } } diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/EmrakulTheAeonsTorn.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/EmrakulTheAeonsTorn.java index c8141e042f..11b0df213d 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/EmrakulTheAeonsTorn.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/EmrakulTheAeonsTorn.java @@ -28,11 +28,6 @@ package mage.sets.riseoftheeldrazi; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -44,11 +39,16 @@ import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.ProtectionAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterSpell; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorlessPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.game.turn.TurnMod; import mage.players.Player; @@ -106,15 +106,15 @@ class EmrakulTheAeonsTornOnCastAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = (Spell) game.getObject(event.getTargetId()); - if (this.getSourceId().equals(spell.getSourceId())) { - return true; - } - } - return false; + Spell spell = (Spell) game.getObject(event.getTargetId()); + return this.getSourceId().equals(spell.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/GravityWell.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/GravityWell.java index 2692021118..9d26571ba2 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/GravityWell.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/GravityWell.java @@ -29,17 +29,23 @@ package mage.sets.riseoftheeldrazi; import java.util.Iterator; import java.util.UUID; - -import mage.constants.*; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; -import mage.cards.CardImpl; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; -import mage.abilities.keyword.FlyingAbility; import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.Effect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SubLayer; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; /** @@ -52,7 +58,6 @@ public class GravityWell extends CardImpl { super(ownerId, 185, "Gravity Well", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}{G}"); this.expansionSetCode = "ROE"; - // Whenever a creature with flying attacks, it loses flying until end of turn. this.addAbility(new GravityWellTriggeredAbility()); } @@ -70,82 +75,86 @@ public class GravityWell extends CardImpl { class GravityWellTriggeredAbility extends TriggeredAbilityImpl { public GravityWellTriggeredAbility() { - super(Zone.BATTLEFIELD, new GravityWellEffect()); + super(Zone.BATTLEFIELD, new GravityWellEffect()); } public GravityWellTriggeredAbility(final GravityWellTriggeredAbility ability) { - super(ability); + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED ) { - Permanent attacker = game.getPermanent(event.getSourceId()); - if (attacker != null && attacker.getAbilities().contains(FlyingAbility.getInstance())) { - for (Effect effect : getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getSourceId())); - } - return true; + Permanent attacker = game.getPermanent(event.getSourceId()); + if (attacker != null && attacker.getAbilities().contains(FlyingAbility.getInstance())) { + for (Effect effect : getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getSourceId())); } + return true; } return false; } @Override public String getRule() { - return "Whenever a creature with flying attacks, " + super.getRule(); + return "Whenever a creature with flying attacks, " + super.getRule(); } @Override public GravityWellTriggeredAbility copy() { - return new GravityWellTriggeredAbility(this); + return new GravityWellTriggeredAbility(this); } } class GravityWellEffect extends ContinuousEffectImpl { public GravityWellEffect() { - super(Duration.EndOfTurn, Outcome.LoseAbility); - staticText = "it loses flying until end of turn"; + super(Duration.EndOfTurn, Outcome.LoseAbility); + staticText = "it loses flying until end of turn"; } public GravityWellEffect(final GravityWellEffect effect) { - super(effect); + super(effect); } @Override public GravityWellEffect copy() { - return new GravityWellEffect(this); + return new GravityWellEffect(this); } @Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { - Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); - if (permanent != null) { + Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); + if (permanent != null) { switch (layer) { case AbilityAddingRemovingEffects_6: if (sublayer == SubLayer.NA) { - for (Iterator i = permanent.getAbilities().iterator(); i.hasNext();) { + for (Iterator i = permanent.getAbilities().iterator(); i.hasNext();) { Ability entry = i.next(); - if (entry.getId().equals(FlyingAbility.getInstance().getId())) - i.remove(); - } + if (entry.getId().equals(FlyingAbility.getInstance().getId())) { + i.remove(); + } + } } break; } return true; } - return false; + return false; } @Override public boolean apply(Game game, Ability source) { - return false; + return false; } @Override public boolean hasLayer(Layer layer) { - return layer == Layer.AbilityAddingRemovingEffects_6; + return layer == Layer.AbilityAddingRemovingEffects_6; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/LighthouseChronologist.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/LighthouseChronologist.java index 0deac7c55b..9271b8d212 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/LighthouseChronologist.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/LighthouseChronologist.java @@ -28,9 +28,7 @@ package mage.sets.riseoftheeldrazi; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; +import java.util.UUID; import mage.MageInt; import mage.abilities.Abilities; import mage.abilities.AbilitiesImpl; @@ -41,13 +39,15 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.LevelUpAbility; import mage.abilities.keyword.LevelerCardBuilder; import mage.cards.LevelerCard; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.turn.TurnMod; -import java.util.UUID; - /** * * @author BetaSteward_at_googlemail.com, noxx @@ -108,12 +108,14 @@ class LighthouseChronologistAbility extends TriggeredAbilityImpl { return new LighthouseChronologistAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE && !game.getActivePlayerId().equals(this.controllerId)) { - return true; - } - return false; + return !game.getActivePlayerId().equals(this.controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/LightmineField.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/LightmineField.java index d32ca3ab7c..e51fb87641 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/LightmineField.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/LightmineField.java @@ -29,17 +29,17 @@ package mage.sets.riseoftheeldrazi; import java.util.List; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -82,12 +82,14 @@ class LightmineFieldTriggeredAbility extends TriggeredAbilityImpl { return new LightmineFieldTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DECLARED_ATTACKERS && !game.getCombat().getAttackers().isEmpty()) { - return true; - } - return false; + return !game.getCombat().getAttackers().isEmpty(); } @Override diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/MorticianBeetle.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/MorticianBeetle.java index f4a47a2c24..7ed2d119c1 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/MorticianBeetle.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/MorticianBeetle.java @@ -27,22 +27,21 @@ */ package mage.sets.riseoftheeldrazi; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; +import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; -import java.util.UUID; - /** * * @author North @@ -81,6 +80,11 @@ class PlayerSacrificesCreatureTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SACRIFICED_PERMANENT; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == EventType.SACRIFICED_PERMANENT) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/NirkanaRevenant.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/NirkanaRevenant.java index c609cfaca1..27d3eca54a 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/NirkanaRevenant.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/NirkanaRevenant.java @@ -28,25 +28,26 @@ package mage.sets.riseoftheeldrazi; import java.util.UUID; -import mage.constants.Outcome; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; -import mage.cards.CardImpl; -import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.continuous.BoostSourceEffect; -import mage.abilities.common.SimpleActivatedAbility; -import mage.constants.Zone; -import mage.constants.Duration; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; -import mage.target.targetpointer.FixedTarget; import mage.Mana; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; -import mage.players.Player; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; /** * @@ -80,39 +81,42 @@ public class NirkanaRevenant extends CardImpl { } } - class NirkanaRevenantTriggeredAbility extends TriggeredAbilityImpl { +class NirkanaRevenantTriggeredAbility extends TriggeredAbilityImpl { public NirkanaRevenantTriggeredAbility() { - super(Zone.BATTLEFIELD, new NirkanaRevenantEffect()); + super(Zone.BATTLEFIELD, new NirkanaRevenantEffect()); } public NirkanaRevenantTriggeredAbility(final NirkanaRevenantTriggeredAbility ability) { - super(ability); + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TAPPED_FOR_MANA ) { - Permanent permanent = game.getPermanent(event.getSourceId()); - if (permanent == null) { - permanent = (Permanent) game.getLastKnownInformation(event.getSourceId(), Zone.BATTLEFIELD); - } - if (permanent != null && permanent.getSubtype().contains("Swamp") && permanent.getControllerId().equals(this.controllerId)) { - getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); - return true; - } - } - return false; + Permanent permanent = game.getPermanent(event.getSourceId()); + if (permanent == null) { + permanent = (Permanent) game.getLastKnownInformation(event.getSourceId(), Zone.BATTLEFIELD); + } + if (permanent != null && permanent.getSubtype().contains("Swamp") && permanent.getControllerId().equals(this.controllerId)) { + getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); + return true; + } + return false; } @Override public NirkanaRevenantTriggeredAbility copy() { - return new NirkanaRevenantTriggeredAbility(this); + return new NirkanaRevenantTriggeredAbility(this); } @Override public String getRule() { - return "Whenever you tap a Swamp for mana, add B to your mana pool (in addition to the mana the land produces)."; + return "Whenever you tap a Swamp for mana, add {B} to your mana pool."; } } @@ -138,8 +142,6 @@ class NirkanaRevenantEffect extends OneShotEffect { @Override public NirkanaRevenantEffect copy() { - return new NirkanaRevenantEffect(this); + return new NirkanaRevenantEffect(this); } } - - diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/PawnOfUlamog.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/PawnOfUlamog.java index 33e4def384..cb8fabc54a 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/PawnOfUlamog.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/PawnOfUlamog.java @@ -28,14 +28,14 @@ package mage.sets.riseoftheeldrazi; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.MageObject; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.CreateTokenEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -87,9 +87,13 @@ class PawnOfUlamogTriggeredAbility extends TriggeredAbilityImpl { return new PawnOfUlamogTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE) { UUID targetId = event.getTargetId(); MageObject card = game.getLastKnownInformation(targetId, Zone.BATTLEFIELD); if (card != null && card instanceof Permanent && !(card instanceof PermanentToken)) { @@ -104,7 +108,6 @@ class PawnOfUlamogTriggeredAbility extends TriggeredAbilityImpl { return true; } } - } return false; } diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/RaidBombardment.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/RaidBombardment.java index 14afa72960..34d9bd0719 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/RaidBombardment.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/RaidBombardment.java @@ -28,15 +28,15 @@ package mage.sets.riseoftheeldrazi; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -80,9 +80,14 @@ class RaidBombardmentTriggeredAbility extends TriggeredAbilityImpl { return new RaidBombardmentTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && game.getActivePlayerId().equals(this.controllerId) ) { + if (game.getActivePlayerId().equals(this.controllerId) ) { Permanent attacker = game.getPermanent(event.getSourceId()); if (attacker != null) { if (attacker.getPower().getValue() <= 2) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/RapaciousOne.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/RapaciousOne.java index 30d3955211..cf2796dfc5 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/RapaciousOne.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/RapaciousOne.java @@ -28,14 +28,14 @@ package mage.sets.riseoftheeldrazi; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; @@ -86,10 +86,14 @@ class RapaciousOneTriggeredAbility extends TriggeredAbilityImpl { return new RapaciousOneTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId) - && ((DamagedPlayerEvent) event).isCombatDamage()) { + if (event.getSourceId().equals(this.sourceId) && ((DamagedPlayerEvent) event).isCombatDamage()) { this.getEffects().clear(); this.addEffect(new CreateTokenEffect(new EldraziSpawnToken(), event.getAmount())); return true; diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/RenegadeDoppelganger.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/RenegadeDoppelganger.java index 2f3f445d5f..2f8202380d 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/RenegadeDoppelganger.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/RenegadeDoppelganger.java @@ -28,19 +28,20 @@ package mage.sets.riseoftheeldrazi; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; import mage.util.functions.EmptyApplyToPermanent; @@ -89,9 +90,14 @@ class RenegadeDoppelgangerTriggeredAbility extends TriggeredAbilityImpl { return new RenegadeDoppelgangerTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && !event.getTargetId().equals(this.getSourceId())) { + if (!event.getTargetId().equals(this.getSourceId())) { Permanent permanent = game.getPermanent(event.getTargetId()); if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && permanent.getControllerId().equals(this.getControllerId())) { for (Effect effect : this.getEffects()) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/UlamogTheInfiniteGyre.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/UlamogTheInfiniteGyre.java index 0d3da8ef6b..cbf82ffea2 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/UlamogTheInfiniteGyre.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/UlamogTheInfiniteGyre.java @@ -96,15 +96,15 @@ class UlamogTheInfiniteGyreDestroyOnCastAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if ( event.getType() == EventType.SPELL_CAST ) { - Spell spell = (Spell)game.getObject(event.getTargetId()); - if ( this.getSourceId().equals(spell.getSourceId())) { - return true; - } - } - return false; + Spell spell = (Spell) game.getObject(event.getTargetId()); + return this.getSourceId().equals(spell.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/Vengevine.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/Vengevine.java index 9c7ba35b6b..307633b212 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/Vengevine.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/Vengevine.java @@ -29,15 +29,15 @@ package mage.sets.riseoftheeldrazi; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.WatcherScope; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect; import mage.abilities.keyword.HasteAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.WatcherScope; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -88,9 +88,14 @@ class VengevineAbility extends TriggeredAbilityImpl { return new VengevineAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.SPELL_CAST && event.getPlayerId().equals(controllerId)) { + if (event.getPlayerId().equals(controllerId)) { Watcher watcher = game.getState().getWatchers().get("CreatureCast", controllerId); if (watcher != null && watcher.conditionMet()) { return true; diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/WorldAtWar.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/WorldAtWar.java index 4e1640d7dc..a2f39bf1f6 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/WorldAtWar.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/WorldAtWar.java @@ -27,25 +27,25 @@ */ package mage.sets.riseoftheeldrazi; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.Set; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.ReboundAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.TurnPhase; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.turn.TurnMod; import mage.watchers.Watcher; import mage.watchers.common.AttackedThisTurnWatcher; -import java.util.Set; -import java.util.UUID; - /** * @author magenoxx_at_gmail.com */ @@ -124,6 +124,11 @@ class UntapDelayedTriggeredAbility extends DelayedTriggeredAbility { return new UntapDelayedTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.PHASE_CHANGED || event.getType() == EventType.COMBAT_PHASE_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.PHASE_CHANGED && this.connectedTurnMod.equals(event.getSourceId())) { diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/EbonyOwlNetsuke.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/EbonyOwlNetsuke.java index 0d469c9204..10d84c5d41 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/EbonyOwlNetsuke.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/EbonyOwlNetsuke.java @@ -28,21 +28,16 @@ package mage.sets.saviorsofkamigawa; import java.util.UUID; -import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; -import mage.constants.TargetController; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -85,10 +80,15 @@ class EbonyOwlNetsukeTriggeredAbility extends TriggeredAbilityImpl { public EbonyOwlNetsukeTriggeredAbility copy() { return new EbonyOwlNetsukeTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && game.getOpponents(controllerId).contains(event.getPlayerId())) { + if (game.getOpponents(controllerId).contains(event.getPlayerId())) { Player player = game.getPlayer(event.getPlayerId()); if (player != null) { for (Effect effect: getEffects() ) { diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/ErayoSoratamiAscendant.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/ErayoSoratamiAscendant.java index a5bccc1785..51e2714c22 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/ErayoSoratamiAscendant.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/ErayoSoratamiAscendant.java @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.token.Token; import mage.target.targetpointer.FixedTarget; import mage.watchers.common.CastSpellLastTurnWatcher; @@ -96,15 +97,15 @@ class ErayoSoratamiAscendantTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher"); - if (watcher != null && watcher.getAmountOfSpellsAllPlayersCastOnCurrentTurn() == 4) { - return true; - } - } - return false; + CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher"); + return watcher != null && watcher.getAmountOfSpellsAllPlayersCastOnCurrentTurn() == 4; } @Override @@ -141,18 +142,21 @@ class ErayosEssenceTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - if (game.getOpponents(getControllerId()).contains(event.getPlayerId())) { - CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher"); - if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 1) { - for (Effect effect : getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - } - return true; - } - } + if (game.getOpponents(getControllerId()).contains(event.getPlayerId())) { + CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher"); + if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 1) { + for (Effect effect : getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); + } + return true; + } } return false; } diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/KiyomaroFirstToStand.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/KiyomaroFirstToStand.java index fc8d11bbb3..bb7d72fb0a 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/KiyomaroFirstToStand.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/KiyomaroFirstToStand.java @@ -50,6 +50,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -109,18 +110,20 @@ class KiyomaroFirstToStandDealsDamageTriggeredAbility extends TriggeredAbilityIm return new KiyomaroFirstToStandDealsDamageTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER + || event.getType() == EventType.DAMAGED_CREATURE + || event.getType() == EventType.DAMAGED_PLANESWALKER; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(GameEvent.EventType.DAMAGED_CREATURE) - || event.getType().equals(GameEvent.EventType.DAMAGED_PLAYER) - || event.getType().equals(GameEvent.EventType.DAMAGED_PLANESWALKER)) { - if (event.getSourceId().equals(this.getSourceId())) { - for (Effect effect : this.getEffects()) { - effect.setValue("damage", event.getAmount()); - } - return true; + if (event.getSourceId().equals(this.getSourceId())) { + for (Effect effect : this.getEffects()) { + effect.setValue("damage", event.getAmount()); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/PureIntentions.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/PureIntentions.java index 02c7ded7a0..7a1ccdf967 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/PureIntentions.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/PureIntentions.java @@ -43,6 +43,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.StackObject; import mage.target.targetpointer.FixedTarget; @@ -84,10 +85,14 @@ class PureIntentionsAllTriggeredAbility extends DelayedTriggeredAbility { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DISCARDED_CARD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (GameEvent.EventType.DISCARDED_CARD.equals(event.getType()) && - game.getOpponents(this.getControllerId()).contains(game.getControllerId(event.getSourceId())) && + if (game.getOpponents(this.getControllerId()).contains(game.getControllerId(event.getSourceId())) && StackObject.class.isInstance(game.getObject(event.getSourceId()))) { Card card = game.getCard(event.getTargetId()); if (card != null && card.getOwnerId().equals(getControllerId())) { @@ -128,15 +133,16 @@ class PureIntentionsTriggeredAbility extends TriggeredAbilityImpl { return new PureIntentionsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DISCARDED_CARD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (GameEvent.EventType.DISCARDED_CARD.equals(event.getType()) && - game.getOpponents(this.getControllerId()).contains(game.getControllerId(event.getSourceId())) && + return game.getOpponents(this.getControllerId()).contains(game.getControllerId(event.getSourceId())) && StackObject.class.isInstance(game.getObject(event.getSourceId())) && - event.getTargetId().equals(getSourceId())) { - return true; - } - return false; + event.getTargetId().equals(getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/CopperhornScout.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/CopperhornScout.java index 703dc88976..ffc6aa8980 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/CopperhornScout.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/CopperhornScout.java @@ -29,15 +29,15 @@ package mage.sets.scarsofmirrodin; import java.util.List; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; @@ -87,12 +87,14 @@ class CopperhornScoutTriggeredAbility extends TriggeredAbilityImpl { return new CopperhornScoutTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { - return true; - } - return false; + return event.getSourceId().equals(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/DissipationField.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/DissipationField.java index c68c61942b..16abfb1eba 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/DissipationField.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/DissipationField.java @@ -28,15 +28,15 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -80,9 +80,14 @@ class DissipationFieldAbility extends TriggeredAbilityImpl { return new DissipationFieldAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getTargetId().equals(this.controllerId)) { + if (event.getTargetId().equals(this.controllerId)) { Permanent permanent = game.getPermanent(event.getSourceId()); if (permanent != null) { this.getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/EzurisArchers.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/EzurisArchers.java index 99aed7807b..523bbbc51c 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/EzurisArchers.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/EzurisArchers.java @@ -28,10 +28,6 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; @@ -39,6 +35,10 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.ReachAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -83,13 +83,14 @@ class BlocksCreatureWithFlyingTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BLOCKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.BLOCKER_DECLARED && event.getSourceId().equals(this.getSourceId()) - && game.getPermanent(event.getTargetId()).getAbilities().containsKey(FlyingAbility.getInstance().getId())) { - return true; - } - return false; + return event.getSourceId().equals(this.getSourceId()) && game.getPermanent(event.getTargetId()).getAbilities().containsKey(FlyingAbility.getInstance().getId()); } @Override diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/FurnaceCelebration.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/FurnaceCelebration.java index 85b1261696..8fbe362f19 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/FurnaceCelebration.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/FurnaceCelebration.java @@ -28,16 +28,17 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DoIfCostPaid; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCreatureOrPlayer; /** @@ -80,12 +81,14 @@ class FurnaceCelebrationAbility extends TriggeredAbilityImpl { return new FurnaceCelebrationAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SACRIFICED_PERMANENT; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT && event.getPlayerId().equals(this.getControllerId()) && !event.getTargetId().equals(sourceId)) { - return true; - } - return false; + return event.getPlayerId().equals(this.getControllerId()) && !event.getTargetId().equals(sourceId); } @Override diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/GolemsHeart.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/GolemsHeart.java index 2a64e09163..0f12cba5cd 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/GolemsHeart.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/GolemsHeart.java @@ -29,14 +29,15 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; /** @@ -77,15 +78,15 @@ class GolemsHeartAbility extends TriggeredAbilityImpl { return new GolemsHeartAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.CAST_SPELL; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getCardType().contains(CardType.ARTIFACT)) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getCardType().contains(CardType.ARTIFACT); } @Override diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/InfiltrationLens.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/InfiltrationLens.java index 61fe030a29..d3c3290bba 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/InfiltrationLens.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/InfiltrationLens.java @@ -28,18 +28,19 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -80,15 +81,18 @@ class EquippedBecomesBlockedTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.CREATURE_BLOCKED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.CREATURE_BLOCKED) { - Permanent equipment = game.getPermanent(sourceId); - if (equipment != null && equipment.getAttachedTo() != null) { - Permanent equipped = game.getPermanent(equipment.getAttachedTo()); - if (equipped.getId().equals(event.getTargetId())) { - return true; - } + Permanent equipment = game.getPermanent(sourceId); + if (equipment != null && equipment.getAttachedTo() != null) { + Permanent equipped = game.getPermanent(equipment.getAttachedTo()); + if (equipped.getId().equals(event.getTargetId())) { + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/KothOfTheHammer.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/KothOfTheHammer.java index 0212838694..c9c727992b 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/KothOfTheHammer.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/KothOfTheHammer.java @@ -28,6 +28,7 @@ package mage.sets.scarsofmirrodin; +import java.util.UUID; import mage.MageInt; import mage.Mana; import mage.abilities.Ability; @@ -45,7 +46,14 @@ import mage.abilities.effects.common.UntapTargetEffect; import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SubLayer; +import mage.constants.TargetController; +import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.common.FilterLandPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; @@ -57,8 +65,6 @@ import mage.game.permanent.token.Token; import mage.target.common.TargetCreatureOrPlayer; import mage.target.common.TargetLandPermanent; -import java.util.UUID; - /** * * @author Loki, North @@ -121,7 +127,7 @@ class KothOfTheHammerToken extends Token { class KothOfTheHammerEmblem extends Emblem { // "Mountains you control have '{T}: This land deals 1 damage to target creature or player.'" public KothOfTheHammerEmblem() { - this.setName("EMBLEM: Kothe of the Hammer"); + this.setName("EMBLEM: Koth of the Hammer"); this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new KothOfTheHammerThirdEffect())); } } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/LiegeOfTheTangle.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/LiegeOfTheTangle.java index 13089d5f07..40c1c6d409 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/LiegeOfTheTangle.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/LiegeOfTheTangle.java @@ -30,14 +30,6 @@ package mage.sets.scarsofmirrodin; import java.util.Iterator; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.SubLayer; -import mage.constants.Zone; import mage.MageInt; import mage.MageObjectReference; import mage.abilities.Ability; @@ -46,11 +38,19 @@ import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SubLayer; +import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.common.FilterLandPermanent; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.permanent.token.Token; import mage.target.Target; @@ -100,16 +100,16 @@ class LiegeOfTheTangleTriggeredAbility extends TriggeredAbilityImpl { return new LiegeOfTheTangleTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - Permanent p = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && p != null && p.getId().equals(this.getSourceId())) { - return true; - } - } - return false; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + Permanent p = game.getPermanent(event.getSourceId()); + return damageEvent.isCombatDamage() && p != null && p.getId().equals(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/LivewireLash.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/LivewireLash.java index 2dea0d0445..1da3f6b9b5 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/LivewireLash.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/LivewireLash.java @@ -28,11 +28,6 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; -import mage.constants.AttachmentType; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; @@ -41,6 +36,11 @@ import mage.abilities.effects.common.continuous.BoostEquippedEffect; import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -90,9 +90,14 @@ class LivewireLashAbility extends TriggeredAbilityImpl { return new LivewireLashAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TARGETED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.TARGETED && event.getTargetId().equals(sourceId)) { + if (event.getTargetId().equals(sourceId)) { if (game.getObject(event.getSourceId()) instanceof Spell) { return true; } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/MimicVat.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/MimicVat.java index 53df62a3c5..b194cda67d 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/MimicVat.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/MimicVat.java @@ -27,8 +27,7 @@ */ package mage.sets.scarsofmirrodin; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.TriggeredAbilityImpl; @@ -41,20 +40,21 @@ import mage.abilities.effects.common.ExileTargetEffect; import mage.abilities.keyword.HasteAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.game.permanent.PermanentToken; import mage.game.permanent.token.EmptyToken; +import mage.players.Player; import mage.target.targetpointer.FixedTarget; import mage.util.CardUtil; -import java.util.UUID; -import mage.players.Player; - /** * @author nantuko */ @@ -98,31 +98,33 @@ class MimicVatTriggeredAbility extends TriggeredAbilityImpl { return new MimicVatTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - - // make sure card is on battlefield - UUID sourceCardId = getSourceId(); - if (game.getPermanent(sourceCardId) == null) { - // or it is being removed - if (game.getLastKnownInformation(sourceCardId, Zone.BATTLEFIELD) == null) { - return false; - } + // make sure card is on battlefield + UUID sourceCardId = getSourceId(); + if (game.getPermanent(sourceCardId) == null) { + // or it is being removed + if (game.getLastKnownInformation(sourceCardId, Zone.BATTLEFIELD) == null) { + return false; } + } - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - Permanent permanent = zEvent.getTarget(); + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + Permanent permanent = zEvent.getTarget(); - if (permanent != null && - zEvent.getToZone() == Zone.GRAVEYARD && - zEvent.getFromZone() == Zone.BATTLEFIELD && - !(permanent instanceof PermanentToken) && - permanent.getCardType().contains(CardType.CREATURE)) { + if (permanent != null && + zEvent.getToZone() == Zone.GRAVEYARD && + zEvent.getFromZone() == Zone.BATTLEFIELD && + !(permanent instanceof PermanentToken) && + permanent.getCardType().contains(CardType.CREATURE)) { - getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); - return true; - } + getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/MolderBeast.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/MolderBeast.java index c858186ec1..1f62917e78 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/MolderBeast.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/MolderBeast.java @@ -28,16 +28,15 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -81,17 +80,17 @@ class MolderBeastTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getFromZone() == Zone.BATTLEFIELD - && zEvent.getToZone() == Zone.GRAVEYARD - && zEvent.getTarget().getCardType().contains(CardType.ARTIFACT)) { - return true; - } - } - return false; + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + return zEvent.getFromZone() == Zone.BATTLEFIELD + && zEvent.getToZone() == Zone.GRAVEYARD + && zEvent.getTarget().getCardType().contains(CardType.ARTIFACT); } @Override diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/MoltenTailMasticore.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/MoltenTailMasticore.java index 05767199d2..c364a6028a 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/MoltenTailMasticore.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/MoltenTailMasticore.java @@ -46,6 +46,7 @@ import mage.constants.Zone; import mage.filter.common.FilterCreatureCard; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetCreatureOrPlayer; @@ -99,9 +100,14 @@ class MoltenTailMasticoreAbility extends TriggeredAbilityImpl { return new MoltenTailMasticoreAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId); + return event.getPlayerId().equals(this.controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/NimDeathmantle.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/NimDeathmantle.java index b4b6ef5f52..060d2c1988 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/NimDeathmantle.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/NimDeathmantle.java @@ -27,7 +27,7 @@ */ package mage.sets.scarsofmirrodin; -import mage.constants.*; +import java.util.UUID; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -43,16 +43,21 @@ import mage.abilities.keyword.EquipAbility; import mage.abilities.keyword.IntimidateAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.game.permanent.PermanentToken; import mage.players.Player; import mage.target.targetpointer.FixedTarget; -import java.util.UUID; - /** * * @author nantuko @@ -101,32 +106,34 @@ class NimDeathmantleTriggeredAbility extends TriggeredAbilityImpl { return new NimDeathmantleTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - - // make sure card is on battlefield - UUID sourceId = getSourceId(); - if (game.getPermanent(sourceId) == null) { - // or it is being removed - if (game.getLastKnownInformation(sourceId, Zone.BATTLEFIELD) == null) { - return false; - } + // make sure card is on battlefield + UUID sourceId = getSourceId(); + if (game.getPermanent(sourceId) == null) { + // or it is being removed + if (game.getLastKnownInformation(sourceId, Zone.BATTLEFIELD) == null) { + return false; } + } - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - Permanent permanent = zEvent.getTarget(); + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + Permanent permanent = zEvent.getTarget(); - if (permanent != null && - permanent.getControllerId().equals(this.controllerId) && - zEvent.getToZone() == Zone.GRAVEYARD && - zEvent.getFromZone() == Zone.BATTLEFIELD && - !(permanent instanceof PermanentToken) && - permanent.getCardType().contains(CardType.CREATURE)) { + if (permanent != null + && permanent.getControllerId().equals(this.controllerId) + && zEvent.getToZone() == Zone.GRAVEYARD + && zEvent.getFromZone() == Zone.BATTLEFIELD + && !(permanent instanceof PermanentToken) + && permanent.getCardType().contains(CardType.CREATURE)) { - getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); - return true; - } + getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/OgreGeargrabber.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/OgreGeargrabber.java index 82e3be572b..13f7a9967b 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/OgreGeargrabber.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/OgreGeargrabber.java @@ -28,11 +28,6 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.TargetController; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; @@ -40,12 +35,18 @@ import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continuous.GainControlTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; import mage.filter.FilterPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; @@ -141,12 +142,14 @@ class OgreGeargrabberDelayedTriggeredAbility extends DelayedTriggeredAbility { this.equipmentId = ability.equipmentId; } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.LOST_CONTROL; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.LOST_CONTROL && event.getPlayerId().equals(controllerId) && event.getTargetId().equals(equipmentId)) { - return true; - } - return false; + return event.getPlayerId().equals(controllerId) && event.getTargetId().equals(equipmentId); } @Override public OgreGeargrabberDelayedTriggeredAbility copy() { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/PrecursorGolem.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/PrecursorGolem.java index 0332d1c5ee..56486ccc83 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/PrecursorGolem.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/PrecursorGolem.java @@ -27,26 +27,26 @@ */ package mage.sets.scarsofmirrodin; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.CopySpellForEachItCouldTargetEffect; import mage.abilities.effects.common.CreateTokenEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; -import mage.game.stack.Spell; -import mage.target.Target; - -import java.util.UUID; -import mage.abilities.effects.common.CopySpellForEachItCouldTargetEffect; import mage.filter.FilterInPlay; import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; import mage.game.permanent.token.GolemToken; +import mage.game.stack.Spell; +import mage.target.Target; import mage.util.TargetAddress; /** @@ -94,15 +94,15 @@ class PrecursorGolemCopyTriggeredAbility extends TriggeredAbilityImpl { return new PrecursorGolemCopyTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (checkSpell(spell, game)) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return checkSpell(spell, game); } private boolean checkSpell(Spell spell, Game game) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/RelicPutrescence.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/RelicPutrescence.java index 5c063b2fcf..4c96874e07 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/RelicPutrescence.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/RelicPutrescence.java @@ -29,17 +29,16 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.counter.AddCountersControllerEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; @@ -93,14 +92,17 @@ class RelicPutrescenceAbility extends TriggeredAbilityImpl { return new RelicPutrescenceAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.TAPPED) { - Permanent enchantment = game.getPermanent(sourceId); - if (enchantment != null && enchantment.getAttachedTo() != null) { - if (event.getTargetId().equals(enchantment.getAttachedTo())) { - return true; - } + Permanent enchantment = game.getPermanent(sourceId); + if (enchantment != null && enchantment.getAttachedTo() != null) { + if (event.getTargetId().equals(enchantment.getAttachedTo())) { + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/SwordOfBodyAndMind.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/SwordOfBodyAndMind.java index c1a1fcbc87..e29f9088ea 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/SwordOfBodyAndMind.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/SwordOfBodyAndMind.java @@ -28,12 +28,9 @@ package mage.sets.scarsofmirrodin; -import mage.constants.AttachmentType; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; +import java.util.UUID; import mage.ObjectColor; +import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; @@ -45,19 +42,22 @@ import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.EquipAbility; import mage.abilities.keyword.ProtectionAbility; import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.permanent.token.WolfToken; import mage.target.targetpointer.FixedTarget; -import java.util.UUID; -import mage.abilities.Ability; - /** * * @author Loki @@ -117,17 +117,20 @@ class SwordOfBodyAndMindAbility extends TriggeredAbilityImpl { return new SwordOfBodyAndMindAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - Permanent p = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - return true; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + Permanent p = game.getPermanent(event.getSourceId()); + if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/TunnelIgnus.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/TunnelIgnus.java index cb13e9a690..0b2216e27f 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/TunnelIgnus.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/TunnelIgnus.java @@ -31,24 +31,23 @@ package mage.sets.scarsofmirrodin; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; - -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.WatcherScope; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; import mage.watchers.Watcher; -import java.util.UUID; -import mage.constants.WatcherScope; - /** * @author Loki */ @@ -130,19 +129,21 @@ class TunnelIgnusTriggeredAbility extends TriggeredAbilityImpl { return new TunnelIgnusTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent != null && permanent.getCardType().contains(CardType.LAND) && game.getOpponents(this.controllerId).contains(permanent.getControllerId())) { - TunnelIgnusWatcher watcher = (TunnelIgnusWatcher) game.getState().getWatchers().get("LandPlayedCount", this.controllerId); - if (watcher != null && watcher.counts.get(permanent.getControllerId()) > 1) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(permanent.getControllerId())); - } - return true; + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent != null && permanent.getCardType().contains(CardType.LAND) && game.getOpponents(this.controllerId).contains(permanent.getControllerId())) { + TunnelIgnusWatcher watcher = (TunnelIgnusWatcher) game.getState().getWatchers().get("LandPlayedCount", this.controllerId); + if (watcher != null && watcher.counts.get(permanent.getControllerId()) > 1) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(permanent.getControllerId())); } - return false; + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/VenserTheSojourner.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/VenserTheSojourner.java index f9103782c4..2182a3dd8a 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/VenserTheSojourner.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/VenserTheSojourner.java @@ -30,11 +30,6 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; import mage.MageObject; - -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.TriggeredAbilityImpl; @@ -48,8 +43,12 @@ import mage.abilities.effects.common.ReturnFromExileEffect; import mage.abilities.effects.common.combat.CantBeBlockedAllEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.TargetController; +import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.FilterPermanent; import mage.filter.FilterSpell; @@ -58,6 +57,7 @@ import mage.filter.predicate.other.OwnerPredicate; import mage.game.Game; import mage.game.command.Emblem; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.stack.Spell; import mage.players.Player; @@ -189,9 +189,14 @@ class VenserTheSojournerSpellCastTriggeredAbility extends TriggeredAbilityImpl { this.rememberSource = ability.rememberSource; } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(this.getControllerId())) { + if (event.getPlayerId().equals(this.getControllerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && filter.match(spell, game)) { if (rememberSource) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/VigilForTheLost.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/VigilForTheLost.java index 5b3de9f46b..31a8376731 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/VigilForTheLost.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/VigilForTheLost.java @@ -29,18 +29,18 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -83,10 +83,14 @@ class VigilForTheLostTriggeredAbility extends TriggeredAbilityImpl { return new VigilForTheLostTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && - ((ZoneChangeEvent)event).getToZone() == Zone.GRAVEYARD && + if (((ZoneChangeEvent)event).getToZone() == Zone.GRAVEYARD && ((ZoneChangeEvent)event).getFromZone() == Zone.BATTLEFIELD) { Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (p.getControllerId().equals(this.getControllerId()) && p.getCardType().contains(CardType.CREATURE)) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/ViridianRevel.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/ViridianRevel.java index 8df89f9a4b..2ba1d92343 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/ViridianRevel.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/ViridianRevel.java @@ -29,16 +29,16 @@ package mage.sets.scarsofmirrodin; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.players.Player; @@ -81,9 +81,14 @@ class ViridianRevelTriggeredAbility extends TriggeredAbilityImpl { return new ViridianRevelTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) { + if (((ZoneChangeEvent)event).isDiesEvent()) { Card card = game.getCard(event.getTargetId()); Player controller = game.getPlayer(getControllerId()); if (controller != null && card != null && card.getCardType().contains(CardType.ARTIFACT) diff --git a/Mage.Sets/src/mage/sets/scourge/PyrostaticPillar.java b/Mage.Sets/src/mage/sets/scourge/PyrostaticPillar.java index 8eefa287fe..0ecc20afea 100644 --- a/Mage.Sets/src/mage/sets/scourge/PyrostaticPillar.java +++ b/Mage.Sets/src/mage/sets/scourge/PyrostaticPillar.java @@ -28,7 +28,6 @@ package mage.sets.scourge; import java.util.UUID; - import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; @@ -38,6 +37,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.target.targetpointer.FixedTarget; @@ -83,16 +83,19 @@ class PyrostaticPillarTriggeredAbility extends TriggeredAbilityImpl { return new PyrostaticPillarTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if(event.getType() == GameEvent.EventType.SPELL_CAST){ - Spell spell = game.getStack().getSpell(event.getTargetId()); - if(spell != null && spell.getConvertedManaCost() <= 3){ - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - return true; + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null && spell.getConvertedManaCost() <= 3){ + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/scourge/XantidSwarm.java b/Mage.Sets/src/mage/sets/scourge/XantidSwarm.java index c411bb82f4..efa1e86873 100644 --- a/Mage.Sets/src/mage/sets/scourge/XantidSwarm.java +++ b/Mage.Sets/src/mage/sets/scourge/XantidSwarm.java @@ -42,6 +42,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -91,9 +92,14 @@ class XantidSwarmTriggeredAbility extends TriggeredAbilityImpl { return new XantidSwarmTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { + if (event.getSourceId().equals(this.getSourceId())) { UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game); this.getEffects().get(0).setTargetPointer(new FixedTarget(defender)); return true; diff --git a/Mage.Sets/src/mage/sets/seventhedition/AEtherFlash.java b/Mage.Sets/src/mage/sets/seventhedition/AEtherFlash.java index ffd7cc6f5d..ea9bcd7ade 100644 --- a/Mage.Sets/src/mage/sets/seventhedition/AEtherFlash.java +++ b/Mage.Sets/src/mage/sets/seventhedition/AEtherFlash.java @@ -38,6 +38,7 @@ import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -78,19 +79,22 @@ class AEtherFlashTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - UUID targetId = event.getTargetId(); - Permanent permanent = game.getPermanent(targetId); - if (filter.match(permanent, getSourceId(), getControllerId(), game)) { - if (getTargets().size() == 0) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(targetId)); - } + UUID targetId = event.getTargetId(); + Permanent permanent = game.getPermanent(targetId); + if (filter.match(permanent, getSourceId(), getControllerId(), game)) { + if (getTargets().size() == 0) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(targetId)); } - return true; } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/seventhedition/FinalFortune.java b/Mage.Sets/src/mage/sets/seventhedition/FinalFortune.java index f3c2fa96bf..14f568597d 100644 --- a/Mage.Sets/src/mage/sets/seventhedition/FinalFortune.java +++ b/Mage.Sets/src/mage/sets/seventhedition/FinalFortune.java @@ -38,6 +38,7 @@ import mage.constants.Outcome; import mage.constants.Rarity; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.turn.TurnMod; import mage.players.Player; @@ -117,14 +118,14 @@ class FinalFortuneLoseDelayedTriggeredAbility extends DelayedTriggeredAbility { return new FinalFortuneLoseDelayedTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE) { - if (connectedTurnMod != null && connectedTurnMod.equals(game.getState().getTurnId())) { - return true; - } - } - return false; + return connectedTurnMod != null && connectedTurnMod.equals(game.getState().getTurnId()); } public void setConnectedTurnMod(UUID connectedTurnMod) { diff --git a/Mage.Sets/src/mage/sets/seventhedition/RelentlessAssault.java b/Mage.Sets/src/mage/sets/seventhedition/RelentlessAssault.java index d2bd4b2283..b55edf8374 100644 --- a/Mage.Sets/src/mage/sets/seventhedition/RelentlessAssault.java +++ b/Mage.Sets/src/mage/sets/seventhedition/RelentlessAssault.java @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.TurnPhase; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.turn.TurnMod; import mage.watchers.Watcher; @@ -160,6 +161,12 @@ class RelentlessAssaultDelayedAddMainPhaseAbility extends DelayedTriggeredAbilit return new RelentlessAssaultDelayedAddMainPhaseAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.PHASE_CHANGED + || event.getType() == EventType.COMBAT_PHASE_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.PHASE_CHANGED && this.connectedTurnMod.equals(event.getSourceId())) { diff --git a/Mage.Sets/src/mage/sets/seventhedition/Rowen.java b/Mage.Sets/src/mage/sets/seventhedition/Rowen.java index 0fb92631fd..92ffd483ee 100644 --- a/Mage.Sets/src/mage/sets/seventhedition/Rowen.java +++ b/Mage.Sets/src/mage/sets/seventhedition/Rowen.java @@ -39,6 +39,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; @@ -84,9 +85,14 @@ class RowenAbility extends TriggeredAbilityImpl { return new RowenAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DREW_CARD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DREW_CARD && event.getPlayerId().equals(this.getControllerId())) { + if (event.getPlayerId().equals(this.getControllerId())) { if (game.getActivePlayerId().equals(this.getControllerId()) && this.lastTriggeredTurn != game.getTurnNum()) { Card card = game.getCard(event.getTargetId()); Player controller = game.getPlayer(this.getControllerId()); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/AshenmoorLiege.java b/Mage.Sets/src/mage/sets/shadowmoor/AshenmoorLiege.java index 5ba1bd8ef5..072db5ea80 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/AshenmoorLiege.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/AshenmoorLiege.java @@ -107,9 +107,14 @@ class AshenmoorLiegeTriggeredAbility extends TriggeredAbilityImpl { return new AshenmoorLiegeTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TARGETED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.TARGETED && event.getTargetId().equals(this.getSourceId()) && game.getOpponents(this.controllerId).contains(event.getPlayerId())) { + if (event.getTargetId().equals(this.getSourceId()) && game.getOpponents(this.controllerId).contains(event.getPlayerId())) { getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); return true; } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/DemigodOfRevenge.java b/Mage.Sets/src/mage/sets/shadowmoor/DemigodOfRevenge.java index 1f2c4b9984..e64a220bb4 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/DemigodOfRevenge.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/DemigodOfRevenge.java @@ -44,6 +44,7 @@ import mage.filter.FilterCard; import mage.filter.predicate.mageobject.NamePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; /** @@ -94,12 +95,14 @@ class DemigodOfRevengeTriggeredAbility extends TriggeredAbilityImpl { return new DemigodOfRevengeTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(GameEvent.EventType.SPELL_CAST) && event.getSourceId().equals(this.getSourceId())) { - return true; - } - return false; + return event.getSourceId().equals(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/shadowmoor/FlourishingDefenses.java b/Mage.Sets/src/mage/sets/shadowmoor/FlourishingDefenses.java index 0357616ac7..43423eb386 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/FlourishingDefenses.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/FlourishingDefenses.java @@ -37,6 +37,7 @@ import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.permanent.token.ElfToken; @@ -81,10 +82,14 @@ class FlourishingDefensesTriggeredAbility extends TriggeredAbilityImpl { return new FlourishingDefensesTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.COUNTER_ADDED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.COUNTER_ADDED - && event.getData().equals(CounterType.M1M1.getName())) { + if (event.getData().equals(CounterType.M1M1.getName())) { Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId()); if (permanent.getCardType().contains(CardType.CREATURE)) { return true; diff --git a/Mage.Sets/src/mage/sets/shadowmoor/HollowbornBarghest.java b/Mage.Sets/src/mage/sets/shadowmoor/HollowbornBarghest.java index 81864e22c2..a94d495c56 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/HollowbornBarghest.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/HollowbornBarghest.java @@ -45,6 +45,7 @@ import mage.constants.TargetController; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; /** @@ -124,9 +125,14 @@ class HollowbornBarghestTriggeredAbility extends TriggeredAbilityImpl { return new HollowbornBarghestTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && game.getOpponents(controllerId).contains(event.getPlayerId())) { + if (game.getOpponents(controllerId).contains(event.getPlayerId())) { Player opponent = game.getPlayer(event.getPlayerId()); if (opponent != null && opponent.getHand().size() == 0) { opponent.loseLife(2, game); diff --git a/Mage.Sets/src/mage/sets/shadowmoor/RakingCanopy.java b/Mage.Sets/src/mage/sets/shadowmoor/RakingCanopy.java index 2f1ec92133..d1f35cab7e 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/RakingCanopy.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/RakingCanopy.java @@ -38,6 +38,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -81,19 +82,22 @@ class RakingCanopyTriggeredAbility extends TriggeredAbilityImpl { return new RakingCanopyTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) { - Permanent attacker = game.getPermanent(event.getSourceId()); - if (attacker == null || !attacker.getAbilities().contains(FlyingAbility.getInstance())) { - return false; - } - if (event.getTargetId().equals(this.getControllerId())) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(attacker.getId())); - } - return true; + Permanent attacker = game.getPermanent(event.getSourceId()); + if (attacker == null || !attacker.getAbilities().contains(FlyingAbility.getInstance())) { + return false; + } + if (event.getTargetId().equals(this.getControllerId())) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(attacker.getId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/SpitefulVisions.java b/Mage.Sets/src/mage/sets/shadowmoor/SpitefulVisions.java index 0900ed73da..d416764491 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/SpitefulVisions.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/SpitefulVisions.java @@ -28,9 +28,6 @@ package mage.sets.shadowmoor; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbility; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.BeginningOfDrawTriggeredAbility; @@ -38,10 +35,13 @@ import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DrawCardTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.TargetController; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -83,9 +83,14 @@ class SpitefulVisionsTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DREW_CARD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DREW_CARD && event.getPlayerId() != null) { + if (event.getPlayerId() != null) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/TowerAbove.java b/Mage.Sets/src/mage/sets/shadowmoor/TowerAbove.java index 7528a7e291..fc2dcde318 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/TowerAbove.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/TowerAbove.java @@ -45,6 +45,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; import mage.target.targetpointer.FixedTarget; @@ -127,10 +128,14 @@ class TowerAboveTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED - && event.getSourceId().equals(this.getSourceId())) { + if (event.getSourceId().equals(this.getSourceId())) { this.getTargets().clear(); TargetCreaturePermanent target = new TargetCreaturePermanent(); this.addTarget(target); diff --git a/Mage.Sets/src/mage/sets/shardsofalara/AngelicBenediction.java b/Mage.Sets/src/mage/sets/shardsofalara/AngelicBenediction.java index fb9757e95e..ee4e35dfd6 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/AngelicBenediction.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/AngelicBenediction.java @@ -28,13 +28,13 @@ package mage.sets.shardsofalara; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.TapTargetEffect; import mage.abilities.keyword.ExaltedAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -82,9 +82,14 @@ class AngelicBenedictionTriggeredAbility extends TriggeredAbilityImpl { return new AngelicBenedictionTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DECLARED_ATTACKERS && game.getActivePlayerId().equals(this.controllerId)) { + if (game.getActivePlayerId().equals(this.controllerId)) { if (game.getCombat().attacksAlone()) { return true; } diff --git a/Mage.Sets/src/mage/sets/shardsofalara/BattlegraceAngel.java b/Mage.Sets/src/mage/sets/shardsofalara/BattlegraceAngel.java index ac3646c87c..ac0a0ca696 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/BattlegraceAngel.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/BattlegraceAngel.java @@ -96,9 +96,14 @@ class BattlegraceAngelAbility extends TriggeredAbilityImpl { return new BattlegraceAngelAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DECLARED_ATTACKERS && game.getActivePlayerId().equals(this.controllerId) ) { + if (game.getActivePlayerId().equals(this.controllerId) ) { if (game.getCombat().attacksAlone()) { for (Effect effect: this.getEffects()) { effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0))); diff --git a/Mage.Sets/src/mage/sets/shardsofalara/CradleOfVitality.java b/Mage.Sets/src/mage/sets/shardsofalara/CradleOfVitality.java index 93c64d92bb..a025c8c109 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/CradleOfVitality.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/CradleOfVitality.java @@ -28,15 +28,15 @@ package mage.sets.shardsofalara; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; @@ -88,9 +88,14 @@ class CradleOfVitalityGainLifeTriggeredAbility extends TriggeredAbilityImpl { return new CradleOfVitalityGainLifeTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.GAINED_LIFE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.GAINED_LIFE && event.getPlayerId().equals(this.controllerId)) { + if (event.getPlayerId().equals(this.controllerId)) { this.getEffects().get(0).setValue("amount", event.getAmount()); return true; } diff --git a/Mage.Sets/src/mage/sets/shardsofalara/Drumhunter.java b/Mage.Sets/src/mage/sets/shardsofalara/Drumhunter.java index 9029908afa..6f11a6e1fa 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/Drumhunter.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/Drumhunter.java @@ -28,19 +28,20 @@ package mage.sets.shardsofalara; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.mana.ColorlessManaAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.Filter; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.PowerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -95,6 +96,11 @@ class DrumHunterTriggeredAbility extends TriggeredAbilityImpl { return new DrumHunterTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { diff --git a/Mage.Sets/src/mage/sets/shardsofalara/ExuberantFirestoker.java b/Mage.Sets/src/mage/sets/shardsofalara/ExuberantFirestoker.java index 71f96db677..c1fa5e7a72 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/ExuberantFirestoker.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/ExuberantFirestoker.java @@ -28,19 +28,20 @@ package mage.sets.shardsofalara; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.mana.ColorlessManaAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.Filter; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.PowerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.TargetPlayer; /** @@ -97,12 +98,14 @@ class ExuberantFirestokerTriggeredAbility extends TriggeredAbilityImpl { return new ExuberantFirestokerTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { - return true; - } - return false; + return event.getPlayerId().equals(this.controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/shardsofalara/Manaplasm.java b/Mage.Sets/src/mage/sets/shardsofalara/Manaplasm.java index d7615f200e..56944a32e1 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/Manaplasm.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/Manaplasm.java @@ -28,18 +28,18 @@ package mage.sets.shardsofalara; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.target.targetpointer.FixedTarget; @@ -85,17 +85,20 @@ class ManaplasmAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getControllerId().equals(controllerId)) { - this.getEffects().remove(0); - int x = spell.getConvertedManaCost(); - this.addEffect(new BoostSourceEffect(x,x, Duration.EndOfTurn)); - this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); - return true; - } + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null && spell.getControllerId().equals(controllerId)) { + this.getEffects().remove(0); + int x = spell.getConvertedManaCost(); + this.addEffect(new BoostSourceEffect(x,x, Duration.EndOfTurn)); + this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/shardsofalara/MemoryErosion.java b/Mage.Sets/src/mage/sets/shardsofalara/MemoryErosion.java index 14f2cd93a5..5bb12e51f6 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/MemoryErosion.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/MemoryErosion.java @@ -28,15 +28,15 @@ package mage.sets.shardsofalara; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.target.targetpointer.FixedTarget; @@ -78,14 +78,17 @@ class SpellCastTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && game.getOpponents(this.getControllerId()).contains(spell.getControllerId())) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); - return true; - } + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null && game.getOpponents(this.getControllerId()).contains(spell.getControllerId())) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/shardsofalara/MightyEmergence.java b/Mage.Sets/src/mage/sets/shardsofalara/MightyEmergence.java index e340be7c79..d409f300f1 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/MightyEmergence.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/MightyEmergence.java @@ -28,23 +28,23 @@ package mage.sets.shardsofalara; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.Filter; import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.mageobject.PowerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -88,19 +88,22 @@ class MightyEmergenceTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - UUID targetId = event.getTargetId(); - Permanent permanent = game.getPermanent(targetId); - if (filter.match(permanent, getSourceId(), getControllerId(), game)) { - if (getTargets().size() == 0) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(targetId)); - } + UUID targetId = event.getTargetId(); + Permanent permanent = game.getPermanent(targetId); + if (filter.match(permanent, getSourceId(), getControllerId(), game)) { + if (getTargets().size() == 0) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(targetId)); } - return true; } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/shardsofalara/PrinceOfThralls.java b/Mage.Sets/src/mage/sets/shardsofalara/PrinceOfThralls.java index 581a1106ec..80f01f08aa 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/PrinceOfThralls.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/PrinceOfThralls.java @@ -28,10 +28,6 @@ package mage.sets.shardsofalara; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -40,9 +36,13 @@ import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -91,19 +91,22 @@ class PrinceOfThrallsTriggeredAbility extends TriggeredAbilityImpl { return new PrinceOfThrallsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.getToZone() == Zone.GRAVEYARD) { - if (zEvent.getFromZone() == Zone.BATTLEFIELD) { - Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (game.getOpponents(this.getControllerId()).contains(permanent.getControllerId())) { - for (Effect effect : getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - } - return true; + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getToZone() == Zone.GRAVEYARD) { + if (zEvent.getFromZone() == Zone.BATTLEFIELD) { + Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + if (game.getOpponents(this.getControllerId()).contains(permanent.getControllerId())) { + for (Effect effect : getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); } + return true; } } } diff --git a/Mage.Sets/src/mage/sets/shardsofalara/QuietusSpike.java b/Mage.Sets/src/mage/sets/shardsofalara/QuietusSpike.java index c9f169b29f..971e1eee26 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/QuietusSpike.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/QuietusSpike.java @@ -28,11 +28,6 @@ package mage.sets.shardsofalara; import java.util.UUID; -import mage.constants.AttachmentType; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; @@ -43,9 +38,15 @@ import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.DeathtouchAbility; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -94,17 +95,20 @@ class QuietusSpikeTriggeredAbility extends TriggeredAbilityImpl { return new QuietusSpikeTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; - Permanent p = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - return true; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + Permanent p = game.getPermanent(event.getSourceId()); + if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/shardsofalara/RafiqOfTheMany.java b/Mage.Sets/src/mage/sets/shardsofalara/RafiqOfTheMany.java index 9fd2d5a703..feb186fc1f 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/RafiqOfTheMany.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/RafiqOfTheMany.java @@ -95,9 +95,14 @@ class RafiqOfTheManyAbility extends TriggeredAbilityImpl { return new RafiqOfTheManyAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_ATTACKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DECLARED_ATTACKERS && game.getActivePlayerId().equals(this.controllerId) ) { + if (game.getActivePlayerId().equals(this.controllerId) ) { if (game.getCombat().attacksAlone()) { for (Effect effect: this.getEffects()) { effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0))); diff --git a/Mage.Sets/src/mage/sets/shardsofalara/Skeletonize.java b/Mage.Sets/src/mage/sets/shardsofalara/Skeletonize.java index aa1d7aa00d..f9000f459e 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/Skeletonize.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/Skeletonize.java @@ -28,11 +28,6 @@ package mage.sets.shardsofalara; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; @@ -44,6 +39,11 @@ import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.RegenerateSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -123,15 +123,18 @@ class SkeletonizeDelayedTriggeredAbility extends DelayedTriggeredAbility { return new SkeletonizeDelayedTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(EventType.ZONE_CHANGE)) { - ZoneChangeEvent zce = (ZoneChangeEvent) event; - if (zce.isDiesEvent()) { - DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", this.getSourceId()); - if (watcher != null) { - return watcher.wasDamaged(zce.getTarget(), game); - } + ZoneChangeEvent zce = (ZoneChangeEvent) event; + if (zce.isDiesEvent()) { + DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", this.getSourceId()); + if (watcher != null) { + return watcher.wasDamaged(zce.getTarget(), game); } } return false; diff --git a/Mage.Sets/src/mage/sets/shardsofalara/SunseedNurturer.java b/Mage.Sets/src/mage/sets/shardsofalara/SunseedNurturer.java index 096f447de3..48981e3b3e 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/SunseedNurturer.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/SunseedNurturer.java @@ -28,19 +28,20 @@ package mage.sets.shardsofalara; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.mana.ColorlessManaAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.Filter; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.PowerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -95,12 +96,14 @@ class SunseedNurturerTriggeredAbility extends TriggeredAbilityImpl { return new SunseedNurturerTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { - return true; - } - return false; + return event.getPlayerId().equals(this.controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/stronghold/HornOfGreed.java b/Mage.Sets/src/mage/sets/stronghold/HornOfGreed.java index 1183e47a5f..b210f4313c 100644 --- a/Mage.Sets/src/mage/sets/stronghold/HornOfGreed.java +++ b/Mage.Sets/src/mage/sets/stronghold/HornOfGreed.java @@ -36,6 +36,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -77,13 +78,15 @@ class HornOfGreedAbility extends TriggeredAbilityImpl { return new HornOfGreedAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.LAND_PLAYED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.LAND_PLAYED) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); - return true; - } - return false; + this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/stronghold/Overgrowth.java b/Mage.Sets/src/mage/sets/stronghold/Overgrowth.java index 0e9c8f527c..2d4aec7bcc 100644 --- a/Mage.Sets/src/mage/sets/stronghold/Overgrowth.java +++ b/Mage.Sets/src/mage/sets/stronghold/Overgrowth.java @@ -41,6 +41,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; @@ -94,18 +95,21 @@ class OvergrowthTriggeredAbility extends TriggeredManaAbility { return new OvergrowthTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent enchantment = game.getPermanent(this.getSourceId()); - if(event.getType() == GameEvent.EventType.TAPPED_FOR_MANA){ - if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { - Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); - if (enchanted != null) { - getEffects().get(0).setTargetPointer(new FixedTarget(enchanted.getControllerId())); - return true; - } + if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { + Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); + if (enchanted != null) { + getEffects().get(0).setTargetPointer(new FixedTarget(enchanted.getControllerId())); + return true; } - } + } return false; } diff --git a/Mage.Sets/src/mage/sets/stronghold/SacredGround.java b/Mage.Sets/src/mage/sets/stronghold/SacredGround.java index d10fc0980d..6b14762dae 100644 --- a/Mage.Sets/src/mage/sets/stronghold/SacredGround.java +++ b/Mage.Sets/src/mage/sets/stronghold/SacredGround.java @@ -28,8 +28,6 @@ package mage.sets.stronghold; import java.util.UUID; - -import mage.MageObject; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect; import mage.cards.CardImpl; @@ -38,9 +36,9 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; -import mage.game.stack.StackObject; import mage.target.targetpointer.FixedTarget; /** @@ -83,10 +81,14 @@ class SacredGroundTriggeredAbility extends TriggeredAbilityImpl { return new SacredGroundTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (GameEvent.EventType.ZONE_CHANGE.equals(event.getType()) && - game.getOpponents(this.getControllerId()).contains(game.getControllerId(event.getSourceId()))) { + if (game.getOpponents(this.getControllerId()).contains(game.getControllerId(event.getSourceId()))) { ZoneChangeEvent zce = (ZoneChangeEvent) event; if (Zone.BATTLEFIELD.equals(zce.getFromZone()) && Zone.GRAVEYARD.equals(zce.getToZone())) { Permanent targetPermanent = zce.getTarget(); diff --git a/Mage.Sets/src/mage/sets/stronghold/WallOfEssence.java b/Mage.Sets/src/mage/sets/stronghold/WallOfEssence.java index 0c4f7ab064..fe9b995e0d 100644 --- a/Mage.Sets/src/mage/sets/stronghold/WallOfEssence.java +++ b/Mage.Sets/src/mage/sets/stronghold/WallOfEssence.java @@ -41,6 +41,7 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedCreatureEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; /** @@ -88,10 +89,14 @@ class WallOfEssenceTriggeredAbility extends TriggeredAbilityImpl { return new WallOfEssenceTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId) - && ((DamagedCreatureEvent)event).isCombatDamage() ) { + if (event.getTargetId().equals(this.sourceId) && ((DamagedCreatureEvent)event).isCombatDamage() ) { this.getEffects().get(0).setValue("damageAmount", event.getAmount()); return true; } diff --git a/Mage.Sets/src/mage/sets/tempestremastered/CoffinQueen.java b/Mage.Sets/src/mage/sets/tempestremastered/CoffinQueen.java index eedb00ce94..31c7159c47 100644 --- a/Mage.Sets/src/mage/sets/tempestremastered/CoffinQueen.java +++ b/Mage.Sets/src/mage/sets/tempestremastered/CoffinQueen.java @@ -36,7 +36,6 @@ import mage.abilities.common.SkipUntapOptionalAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; import mage.abilities.effects.common.ExileTargetEffect; import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; import mage.cards.CardImpl; @@ -48,6 +47,7 @@ import mage.constants.Zone; import mage.filter.common.FilterCreatureCard; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.common.TargetCardInGraveyard; import mage.target.targetpointer.FixedTarget; @@ -130,6 +130,12 @@ class CoffinQueenDelayedTriggeredAbility extends DelayedTriggeredAbility { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.LOST_CONTROL + || event.getType() == EventType.UNTAPPED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { diff --git a/Mage.Sets/src/mage/sets/tempestremastered/Spellshock.java b/Mage.Sets/src/mage/sets/tempestremastered/Spellshock.java index 1cbf2dcdd8..95ff8787b1 100644 --- a/Mage.Sets/src/mage/sets/tempestremastered/Spellshock.java +++ b/Mage.Sets/src/mage/sets/tempestremastered/Spellshock.java @@ -37,6 +37,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; import mage.target.targetpointer.FixedTarget; @@ -81,16 +82,19 @@ class SpellshockTriggeredAbility extends TriggeredAbilityImpl { return new SpellshockTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if(event.getType() == GameEvent.EventType.SPELL_CAST){ - Spell spell = game.getStack().getSpell(event.getTargetId()); - if(spell != null){ - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } - return true; + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null){ + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/tempestremastered/WallOfSouls.java b/Mage.Sets/src/mage/sets/tempestremastered/WallOfSouls.java index 903774db9c..84c284b0f1 100644 --- a/Mage.Sets/src/mage/sets/tempestremastered/WallOfSouls.java +++ b/Mage.Sets/src/mage/sets/tempestremastered/WallOfSouls.java @@ -41,6 +41,7 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedCreatureEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.common.TargetOpponent; @@ -91,10 +92,14 @@ class WallOfSoulsTriggeredAbility extends TriggeredAbilityImpl { return new WallOfSoulsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId) - && ((DamagedCreatureEvent)event).isCombatDamage() ) { + if (event.getTargetId().equals(this.sourceId) && ((DamagedCreatureEvent)event).isCombatDamage()) { this.getEffects().get(0).setValue("damage", event.getAmount()); return true; } diff --git a/Mage.Sets/src/mage/sets/tenthedition/AngelsFeather.java b/Mage.Sets/src/mage/sets/tenthedition/AngelsFeather.java index 2d01c26e37..c518a21d95 100644 --- a/Mage.Sets/src/mage/sets/tenthedition/AngelsFeather.java +++ b/Mage.Sets/src/mage/sets/tenthedition/AngelsFeather.java @@ -29,12 +29,12 @@ package mage.sets.tenthedition; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -78,15 +78,15 @@ class AngelsFeatherAbility extends TriggeredAbilityImpl { return new AngelsFeatherAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).isWhite()) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getColor(game).isWhite(); } @Override diff --git a/Mage.Sets/src/mage/sets/tenthedition/KrakensEye.java b/Mage.Sets/src/mage/sets/tenthedition/KrakensEye.java index 81e51ec053..147a190ad4 100644 --- a/Mage.Sets/src/mage/sets/tenthedition/KrakensEye.java +++ b/Mage.Sets/src/mage/sets/tenthedition/KrakensEye.java @@ -29,12 +29,12 @@ package mage.sets.tenthedition; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -78,15 +78,15 @@ class KrakensEyeAbility extends TriggeredAbilityImpl { return new KrakensEyeAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).isBlue()) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getColor(game).isBlue(); } @Override diff --git a/Mage.Sets/src/mage/sets/tenthedition/Megrim.java b/Mage.Sets/src/mage/sets/tenthedition/Megrim.java index 171234edc7..0f7b676328 100644 --- a/Mage.Sets/src/mage/sets/tenthedition/Megrim.java +++ b/Mage.Sets/src/mage/sets/tenthedition/Megrim.java @@ -29,15 +29,15 @@ package mage.sets.tenthedition; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetOpponent; /** @@ -65,6 +65,7 @@ public class Megrim extends CardImpl { } class MergimTriggeredAbility extends TriggeredAbilityImpl { + MergimTriggeredAbility() { super(Zone.BATTLEFIELD, new DamageTargetEffect(2)); this.addTarget(new TargetOpponent()); @@ -79,9 +80,14 @@ class MergimTriggeredAbility extends TriggeredAbilityImpl { return new MergimTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DISCARDED_CARD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DISCARDED_CARD && game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) { + if (game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) { this.getTargets().get(0).add(event.getPlayerId(), game); return true; } diff --git a/Mage.Sets/src/mage/sets/tenthedition/WurmsTooth.java b/Mage.Sets/src/mage/sets/tenthedition/WurmsTooth.java index 31b2ff0251..b60b295744 100644 --- a/Mage.Sets/src/mage/sets/tenthedition/WurmsTooth.java +++ b/Mage.Sets/src/mage/sets/tenthedition/WurmsTooth.java @@ -29,12 +29,12 @@ package mage.sets.tenthedition; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -78,15 +78,15 @@ class WurmsToothAbility extends TriggeredAbilityImpl { return new WurmsToothAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).isGreen()) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getColor(game).isGreen(); } @Override diff --git a/Mage.Sets/src/mage/sets/thedark/Venom.java b/Mage.Sets/src/mage/sets/thedark/Venom.java index 385cbe0be9..42eb58e716 100644 --- a/Mage.Sets/src/mage/sets/thedark/Venom.java +++ b/Mage.Sets/src/mage/sets/thedark/Venom.java @@ -28,10 +28,6 @@ package mage.sets.thedark; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility; @@ -40,8 +36,13 @@ import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; @@ -57,7 +58,6 @@ public class Venom extends CardImpl { this.expansionSetCode = "DRK"; this.subtype.add("Aura"); - // Enchant creature TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); @@ -94,28 +94,31 @@ class VenomTriggeredAbility extends TriggeredAbilityImpl { return new VenomTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BLOCKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) { - Permanent blocker = game.getPermanent(event.getSourceId()); - Permanent blocked = game.getPermanent(event.getTargetId()); - Permanent enchantment = game.getPermanent(this.getSourceId()); - if (enchantment != null && enchantment.getAttachedTo() != null) { - Permanent enchantedCreature = game.getPermanent(enchantment.getAttachedTo()); - if (enchantedCreature != null) { - if (blocker != null && blocker != enchantedCreature - && !blocker.getSubtype().contains("Wall") - && blocked == enchantedCreature) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId())); - return true; - } - if (blocker != null && blocker == enchantedCreature - && !blocked.getSubtype().contains("Wall")) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(blocked.getId())); - return true; - } - } - } + Permanent blocker = game.getPermanent(event.getSourceId()); + Permanent blocked = game.getPermanent(event.getTargetId()); + Permanent enchantment = game.getPermanent(this.getSourceId()); + if (enchantment != null && enchantment.getAttachedTo() != null) { + Permanent enchantedCreature = game.getPermanent(enchantment.getAttachedTo()); + if (enchantedCreature != null) { + if (blocker != null && blocker != enchantedCreature + && !blocker.getSubtype().contains("Wall") + && blocked == enchantedCreature) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId())); + return true; + } + if (blocker != null && blocker == enchantedCreature + && !blocked.getSubtype().contains("Wall")) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(blocked.getId())); + return true; + } + } } return false; } diff --git a/Mage.Sets/src/mage/sets/theros/BidentOfThassa.java b/Mage.Sets/src/mage/sets/theros/BidentOfThassa.java index ceed96023e..71e9cff04b 100644 --- a/Mage.Sets/src/mage/sets/theros/BidentOfThassa.java +++ b/Mage.Sets/src/mage/sets/theros/BidentOfThassa.java @@ -30,7 +30,6 @@ package mage.sets.theros; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; @@ -44,6 +43,7 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -91,14 +91,17 @@ class BidentOfThassaTriggeredAbility extends TriggeredAbilityImpl { return new BidentOfThassaTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) { - if (((DamagedPlayerEvent) event).isCombatDamage()) { - Permanent creature = game.getPermanent(event.getSourceId()); - if (creature != null && creature.getControllerId().equals(controllerId)) { - return true; - } + if (((DamagedPlayerEvent) event).isCombatDamage()) { + Permanent creature = game.getPermanent(event.getSourceId()); + if (creature != null && creature.getControllerId().equals(controllerId)) { + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/theros/FlamespeakerAdept.java b/Mage.Sets/src/mage/sets/theros/FlamespeakerAdept.java index 519b16ce3d..0490ccd43a 100644 --- a/Mage.Sets/src/mage/sets/theros/FlamespeakerAdept.java +++ b/Mage.Sets/src/mage/sets/theros/FlamespeakerAdept.java @@ -86,12 +86,14 @@ class ScryTriggeredAbility extends TriggeredAbilityImpl { return new ScryTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SCRY; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(EventType.SCRY) && event.getPlayerId().equals(this.getControllerId())) { - return true; - } - return false; + return event.getPlayerId().equals(this.getControllerId()); } @Override diff --git a/Mage.Sets/src/mage/sets/theros/RescueFromTheUnderworld.java b/Mage.Sets/src/mage/sets/theros/RescueFromTheUnderworld.java index 013fa387ee..6878692be2 100644 --- a/Mage.Sets/src/mage/sets/theros/RescueFromTheUnderworld.java +++ b/Mage.Sets/src/mage/sets/theros/RescueFromTheUnderworld.java @@ -27,6 +27,7 @@ */ package mage.sets.theros; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.Mode; @@ -37,11 +38,16 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.ExileSpellEffect; import mage.cards.Card; import mage.cards.CardImpl; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreatureCard; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; @@ -49,8 +55,6 @@ import mage.target.common.TargetCardInGraveyard; import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetControlledCreaturePermanent; -import java.util.UUID; - /** * * Once you announce you’re casting Rescue from the Underworld, no player may attempt to @@ -187,9 +191,14 @@ class RescueFromTheUnderworldDelayedTriggeredAbility extends DelayedTriggeredAbi super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId); + return event.getPlayerId().equals(this.controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/theros/ThassasEmissary.java b/Mage.Sets/src/mage/sets/theros/ThassasEmissary.java index 6b92d1cc05..f3a2973349 100644 --- a/Mage.Sets/src/mage/sets/theros/ThassasEmissary.java +++ b/Mage.Sets/src/mage/sets/theros/ThassasEmissary.java @@ -40,7 +40,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; -import mage.game.events.DamagedPlayerEvent; +import mage.game.events.DamagedEvent; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; @@ -92,9 +92,14 @@ class ThassasEmissaryTriggeredAbility extends TriggeredAbilityImpl { return new ThassasEmissaryTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DAMAGED_PLAYER && ((DamagedPlayerEvent) event).isCombatDamage()) { + if (((DamagedEvent) event).isCombatDamage()) { if (event.getSourceId().equals(this.sourceId)) { return true; } diff --git a/Mage.Sets/src/mage/sets/theros/TimeToFeed.java b/Mage.Sets/src/mage/sets/theros/TimeToFeed.java index 8af58c918d..4fdc3304cb 100644 --- a/Mage.Sets/src/mage/sets/theros/TimeToFeed.java +++ b/Mage.Sets/src/mage/sets/theros/TimeToFeed.java @@ -47,6 +47,7 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.target.Target; @@ -149,9 +150,14 @@ class TimeToFeedDiesTriggeredAbility extends DelayedTriggeredAbility { return new TimeToFeedDiesTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) { + if (((ZoneChangeEvent) event).isDiesEvent()) { if (event.getTargetId().equals(watchedCreatureId)) { Permanent creature = (Permanent) game.getLastKnownInformation(watchedCreatureId, Zone.BATTLEFIELD); if (creature.getZoneChangeCounter(game) == this.zoneChangeCounter) { diff --git a/Mage.Sets/src/mage/sets/theros/TritonTactics.java b/Mage.Sets/src/mage/sets/theros/TritonTactics.java index 4abfcddef9..f58b296660 100644 --- a/Mage.Sets/src/mage/sets/theros/TritonTactics.java +++ b/Mage.Sets/src/mage/sets/theros/TritonTactics.java @@ -49,6 +49,7 @@ import mage.constants.WatcherScope; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; import mage.target.targetpointer.FixedTarget; @@ -145,9 +146,14 @@ class TritonTacticsTriggeredAbility extends DelayedTriggeredAbility { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_COMBAT_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.END_COMBAT_STEP_PRE; + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/timeshifted/EssenceSliver.java b/Mage.Sets/src/mage/sets/timeshifted/EssenceSliver.java index 3bccc6bf0f..3afdd8d5ce 100644 --- a/Mage.Sets/src/mage/sets/timeshifted/EssenceSliver.java +++ b/Mage.Sets/src/mage/sets/timeshifted/EssenceSliver.java @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; @@ -88,18 +89,20 @@ class DealsDamageAllTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE - || event.getType() == GameEvent.EventType.DAMAGED_PLAYER - || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER) { - Permanent creature = game.getPermanent(event.getSourceId()); - if (creature != null && creature.hasSubtype("Sliver")) { - for (Effect effect : this.getEffects()) { - effect.setValue("damage", event.getAmount()); - } - return true; - } + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE + || event.getType() == EventType.DAMAGED_PLAYER + || event.getType() == EventType.DAMAGED_PLANESWALKER; + } + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent creature = game.getPermanent(event.getSourceId()); + if (creature != null && creature.hasSubtype("Sliver")) { + for (Effect effect : this.getEffects()) { + effect.setValue("damage", event.getAmount()); + } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/timeshifted/GrinningTotem.java b/Mage.Sets/src/mage/sets/timeshifted/GrinningTotem.java index c59d4e0118..e9f1a93b72 100644 --- a/Mage.Sets/src/mage/sets/timeshifted/GrinningTotem.java +++ b/Mage.Sets/src/mage/sets/timeshifted/GrinningTotem.java @@ -52,6 +52,7 @@ import mage.constants.Zone; import mage.game.ExileZone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetOpponent; @@ -194,9 +195,14 @@ class GrinningTotemDelayedTriggeredAbility extends DelayedTriggeredAbility { return new GrinningTotemDelayedTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && game.getActivePlayerId().equals(this.getControllerId()); + return game.getActivePlayerId().equals(this.getControllerId()); } @Override diff --git a/Mage.Sets/src/mage/sets/timeshifted/SolkanarTheSwampKing.java b/Mage.Sets/src/mage/sets/timeshifted/SolkanarTheSwampKing.java index 282bb67dd0..a95ba8ee2d 100644 --- a/Mage.Sets/src/mage/sets/timeshifted/SolkanarTheSwampKing.java +++ b/Mage.Sets/src/mage/sets/timeshifted/SolkanarTheSwampKing.java @@ -28,17 +28,17 @@ package mage.sets.timeshifted; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.keyword.SwampwalkAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; /** @@ -87,20 +87,19 @@ class SolkanarTheSwampKingAbility extends TriggeredAbilityImpl { return new SolkanarTheSwampKingAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).isBlack()) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getColor(game).isBlack(); } @Override public String getRule() { return "Whenever a player casts a black spell, you gain 1 life."; } - } diff --git a/Mage.Sets/src/mage/sets/timespiral/GauntletOfPower.java b/Mage.Sets/src/mage/sets/timespiral/GauntletOfPower.java index 9cbcd3812c..1d87783773 100644 --- a/Mage.Sets/src/mage/sets/timespiral/GauntletOfPower.java +++ b/Mage.Sets/src/mage/sets/timespiral/GauntletOfPower.java @@ -53,6 +53,7 @@ import mage.filter.common.FilterLandPermanent; import mage.filter.predicate.mageobject.SupertypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ManaEvent; import mage.game.permanent.Permanent; import mage.players.Player; @@ -145,41 +146,44 @@ class TapForManaAllTriggeredAbility extends TriggeredManaAbility { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TAPPED_FOR_MANA) { - Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); - if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { - ManaEvent mEvent = (ManaEvent) event; - ObjectColor color = (ObjectColor) game.getState().getValue(getSourceId() + "_color"); - if (color != null) { - Mana mana = mEvent.getMana(); - boolean colorFits = false; - if (color.isBlack() && mana.getBlack() > 0) { - colorFits = true; - } else if (color.isBlue() && mana.getBlue() > 0) { - colorFits = true; - } else if (color.isGreen() && mana.getGreen() > 0) { - colorFits = true; - } else if (color.isWhite() && mana.getWhite() > 0) { - colorFits = true; - } else if (color.isRed() && mana.getRed() > 0) { - colorFits = true; - } - if (colorFits) { + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } - for (Effect effect : getEffects()) { - effect.setValue("mana", mEvent.getMana()); - } - switch (setTargetPointer) { - case PERMANENT: - getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); - break; - case PLAYER: - getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getControllerId())); - break; - } - return true; + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) { + ManaEvent mEvent = (ManaEvent) event; + ObjectColor color = (ObjectColor) game.getState().getValue(getSourceId() + "_color"); + if (color != null) { + Mana mana = mEvent.getMana(); + boolean colorFits = false; + if (color.isBlack() && mana.getBlack() > 0) { + colorFits = true; + } else if (color.isBlue() && mana.getBlue() > 0) { + colorFits = true; + } else if (color.isGreen() && mana.getGreen() > 0) { + colorFits = true; + } else if (color.isWhite() && mana.getWhite() > 0) { + colorFits = true; + } else if (color.isRed() && mana.getRed() > 0) { + colorFits = true; + } + if (colorFits) { + + for (Effect effect : getEffects()) { + effect.setValue("mana", mEvent.getMana()); } + switch (setTargetPointer) { + case PERMANENT: + getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId())); + break; + case PLAYER: + getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getControllerId())); + break; + } + return true; } } } diff --git a/Mage.Sets/src/mage/sets/timespiral/NorinTheWary.java b/Mage.Sets/src/mage/sets/timespiral/NorinTheWary.java index fc878f375c..b94593b84c 100644 --- a/Mage.Sets/src/mage/sets/timespiral/NorinTheWary.java +++ b/Mage.Sets/src/mage/sets/timespiral/NorinTheWary.java @@ -41,6 +41,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; @@ -85,14 +86,15 @@ class NorinTheWaryTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST + || event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - switch(event.getType()) { - case SPELL_CAST: - case ATTACKER_DECLARED: - return true; - } - return false; + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/timespiral/ParadoxHaze.java b/Mage.Sets/src/mage/sets/timespiral/ParadoxHaze.java index 7893c69d3c..40c612225b 100644 --- a/Mage.Sets/src/mage/sets/timespiral/ParadoxHaze.java +++ b/Mage.Sets/src/mage/sets/timespiral/ParadoxHaze.java @@ -40,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.turn.TurnMod; import mage.game.turn.UpkeepStep; @@ -96,18 +97,21 @@ class ParadoxHazeTriggeredAbility extends TriggeredAbilityImpl { public ParadoxHazeTriggeredAbility copy() { return new ParadoxHazeTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) { - Permanent permanent = game.getPermanent(this.sourceId); - if (permanent != null) { - Player player = game.getPlayer(permanent.getAttachedTo()); - if (player != null && game.getActivePlayerId().equals(player.getId()) && lastTriggerTurnNumber != game.getTurnNum()) { - lastTriggerTurnNumber = game.getTurnNum(); - this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId())); - return true; - } + Permanent permanent = game.getPermanent(this.sourceId); + if (permanent != null) { + Player player = game.getPlayer(permanent.getAttachedTo()); + if (player != null && game.getActivePlayerId().equals(player.getId()) && lastTriggerTurnNumber != game.getTurnNum()) { + lastTriggerTurnNumber = game.getTurnNum(); + this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId())); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/timespiral/SaffiEriksdotter.java b/Mage.Sets/src/mage/sets/timespiral/SaffiEriksdotter.java index f1f87c4dca..ef34134f21 100644 --- a/Mage.Sets/src/mage/sets/timespiral/SaffiEriksdotter.java +++ b/Mage.Sets/src/mage/sets/timespiral/SaffiEriksdotter.java @@ -44,6 +44,7 @@ import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.target.Target; import mage.target.common.TargetCreaturePermanent; @@ -130,11 +131,16 @@ class SaffiEriksdotterDelayedTriggeredAbility extends DelayedTriggeredAbility { return new SaffiEriksdotterDelayedTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { + if (((ZoneChangeEvent) event).isDiesEvent()) { if (fixedTarget.getFirst(game, this).equals(event.getTargetId())) { - if(this.getControllerId().equals(event.getPlayerId())){ + if (this.getControllerId().equals(event.getPlayerId())){ return true; } } diff --git a/Mage.Sets/src/mage/sets/timespiral/StuffyDoll.java b/Mage.Sets/src/mage/sets/timespiral/StuffyDoll.java index aef854c420..e1495a01e1 100644 --- a/Mage.Sets/src/mage/sets/timespiral/StuffyDoll.java +++ b/Mage.Sets/src/mage/sets/timespiral/StuffyDoll.java @@ -28,10 +28,6 @@ package mage.sets.timespiral; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -42,8 +38,13 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DamageSelfEffect; import mage.abilities.keyword.IndestructibleAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPlayer; @@ -132,9 +133,14 @@ class StuffyDollTriggeredAbility extends TriggeredAbilityImpl { return new StuffyDollTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId)) { + if (event.getTargetId().equals(this.sourceId)) { this.getEffects().get(0).setValue("damageAmount", event.getAmount()); return true; } diff --git a/Mage.Sets/src/mage/sets/urzasdestiny/AetherSting.java b/Mage.Sets/src/mage/sets/urzasdestiny/AetherSting.java index cd409b970a..98b093c721 100644 --- a/Mage.Sets/src/mage/sets/urzasdestiny/AetherSting.java +++ b/Mage.Sets/src/mage/sets/urzasdestiny/AetherSting.java @@ -28,15 +28,16 @@ package mage.sets.urzasdestiny; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -79,10 +80,14 @@ class AetherStingTriggeredAbility extends TriggeredAbilityImpl { return new AetherStingTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST - && game.getOpponents(controllerId).contains(event.getPlayerId())) { + if (game.getOpponents(controllerId).contains(event.getPlayerId())) { Card card = game.getCard(event.getSourceId()); if (card != null && card.getCardType().contains(CardType.CREATURE)) { this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); diff --git a/Mage.Sets/src/mage/sets/urzasdestiny/PhyrexianNegator.java b/Mage.Sets/src/mage/sets/urzasdestiny/PhyrexianNegator.java index 4e1dc26126..ad9be7781f 100644 --- a/Mage.Sets/src/mage/sets/urzasdestiny/PhyrexianNegator.java +++ b/Mage.Sets/src/mage/sets/urzasdestiny/PhyrexianNegator.java @@ -29,19 +29,20 @@ package mage.sets.urzasdestiny; import java.util.UUID; import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.common.SacrificeEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.dynamicvalue.common.StaticValue; -import mage.abilities.effects.common.SacrificeEffect; -import mage.players.Player; -import mage.target.targetpointer.FixedTarget; import mage.constants.Zone; -import mage.game.events.GameEvent; import mage.filter.FilterPermanent; import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; /** * * @author fireshoes @@ -85,10 +86,15 @@ class PhyrexianNegatorTriggeredAbility extends TriggeredAbilityImpl { public PhyrexianNegatorTriggeredAbility copy() { return new PhyrexianNegatorTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId)) { + if (event.getTargetId().equals(this.sourceId)) { UUID controller = game.getControllerId(event.getTargetId()); if (controller != null) { Player player = game.getPlayer(controller); diff --git a/Mage.Sets/src/mage/sets/urzasdestiny/RayneAcademyChancellor.java b/Mage.Sets/src/mage/sets/urzasdestiny/RayneAcademyChancellor.java index d94ad90e34..1edf03ea2d 100644 --- a/Mage.Sets/src/mage/sets/urzasdestiny/RayneAcademyChancellor.java +++ b/Mage.Sets/src/mage/sets/urzasdestiny/RayneAcademyChancellor.java @@ -87,20 +87,23 @@ class RayneAcademyChancellorTriggeredAbility extends TriggeredAbilityImpl { public RayneAcademyChancellorTriggeredAbility copy() { return new RayneAcademyChancellorTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TARGETED; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.TARGETED) { - Player controller = game.getPlayer(this.getControllerId()); - Player targetter = game.getPlayer(event.getPlayerId()); - if (controller != null && targetter != null && !controller.getId().equals(targetter.getId())) { - if (event.getTargetId().equals(controller.getId())) { - return true; - } - Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId()); - if (permanent != null && this.getControllerId().equals(permanent.getControllerId())) { - return true; - } + Player controller = game.getPlayer(this.getControllerId()); + Player targetter = game.getPlayer(event.getPlayerId()); + if (controller != null && targetter != null && !controller.getId().equals(targetter.getId())) { + if (event.getTargetId().equals(controller.getId())) { + return true; + } + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId()); + if (permanent != null && this.getControllerId().equals(permanent.getControllerId())) { + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/MemoryJar.java b/Mage.Sets/src/mage/sets/urzaslegacy/MemoryJar.java index 6d284d86f5..7096f318a4 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/MemoryJar.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/MemoryJar.java @@ -29,10 +29,6 @@ package mage.sets.urzaslegacy; import java.util.Iterator; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; @@ -44,6 +40,9 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; @@ -97,7 +96,7 @@ class MemoryJarEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Cards cards = new CardsImpl(); - //Exil hand + //Exile hand for (UUID playerId: game.getPlayer(source.getControllerId()).getInRange()) { Player player = game.getPlayer(playerId); if (player != null) @@ -197,12 +196,14 @@ class MemoryJarDelayedTriggeredAbility extends DelayedTriggeredAbility { return new MemoryJarDelayedTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.END_TURN_STEP_PRE) { - return true; - } - return false; + return true; } diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/NoMercy.java b/Mage.Sets/src/mage/sets/urzaslegacy/NoMercy.java index c65884d169..d1ecb036de 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/NoMercy.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/NoMercy.java @@ -28,16 +28,16 @@ package mage.sets.urzaslegacy; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -51,7 +51,6 @@ public class NoMercy extends CardImpl { super(ownerId, 56, "No Mercy", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}"); this.expansionSetCode = "ULG"; - // Whenever a creature deals damage to you, destroy it. this.addAbility(new NoMercyTriggeredAbility()); } @@ -64,31 +63,33 @@ public class NoMercy extends CardImpl { public NoMercy copy() { return new NoMercy(this); } - + public class NoMercyTriggeredAbility extends TriggeredAbilityImpl { - public NoMercyTriggeredAbility() - { + + public NoMercyTriggeredAbility() { super(Zone.BATTLEFIELD, new DestroyTargetEffect()); } - + public NoMercyTriggeredAbility(final NoMercyTriggeredAbility ability) { super(ability); } - + @Override public NoMercyTriggeredAbility copy() { - return new NoMercyTriggeredAbility(this); + return new NoMercyTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getPlayerId().equals(this.getControllerId())) { - + if (event.getPlayerId().equals(this.getControllerId())) { Permanent permanent = game.getPermanent(event.getSourceId()); - if(permanent != null && permanent.getCardType().contains(CardType.CREATURE)) - { - for(Effect effect : this.getEffects()) - { + if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) { + for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getSourceId())); } return true; @@ -96,10 +97,11 @@ public class NoMercy extends CardImpl { } return false; } + @Override public String getRule() { return "Whenever a creature deals damage to you, destroy it"; } - + } } diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/Rivalry.java b/Mage.Sets/src/mage/sets/urzaslegacy/Rivalry.java index b0e4770c0c..4b79443702 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/Rivalry.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/Rivalry.java @@ -28,18 +28,18 @@ package mage.sets.urzaslegacy; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.common.FilterLandPermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -87,17 +87,19 @@ class RivalryTriggeredAbility extends TriggeredAbilityImpl { return new RivalryTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) { - if (getTargets().size() == 0) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); - } + if (getTargets().size() == 0) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } - return true; } - return false; + return true; } @Override diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/Scrapheap.java b/Mage.Sets/src/mage/sets/urzaslegacy/Scrapheap.java index cc19a3ba8e..874b130fcc 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/Scrapheap.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/Scrapheap.java @@ -28,17 +28,18 @@ package mage.sets.urzaslegacy; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; @@ -89,33 +90,27 @@ class ScrapheapTriggeredAbility extends TriggeredAbilityImpl { super(Zone.BATTLEFIELD, new GainLifeEffect(1)); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - - if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (permanent != null && permanent.getOwnerId().equals(this.getControllerId())) { - if (filter.match(permanent, sourceId, controllerId, game)) { return true; } - } } - } return false; } - - @Override public String getRule() { return "Whenever an artifact or enchantment is put into your graveyard from the battlefield, you gain 1 life."; } - - - } diff --git a/Mage.Sets/src/mage/sets/urzassaga/Bereavement.java b/Mage.Sets/src/mage/sets/urzassaga/Bereavement.java index 84c1d1371e..cdf0bf19e0 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/Bereavement.java +++ b/Mage.Sets/src/mage/sets/urzassaga/Bereavement.java @@ -28,14 +28,15 @@ package mage.sets.urzassaga; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -80,9 +81,14 @@ class BereavementTriggeredAbility extends TriggeredAbilityImpl { return new BereavementTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) { + if (((ZoneChangeEvent)event).isDiesEvent()) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && permanent.getColor(game).isGreen()) { this.getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getControllerId())); diff --git a/Mage.Sets/src/mage/sets/urzassaga/CarpetOfFlowers.java b/Mage.Sets/src/mage/sets/urzassaga/CarpetOfFlowers.java index 8d9e96a143..7b6794af6d 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/CarpetOfFlowers.java +++ b/Mage.Sets/src/mage/sets/urzassaga/CarpetOfFlowers.java @@ -45,6 +45,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.common.TargetOpponent; @@ -77,12 +78,10 @@ public class CarpetOfFlowers extends CardImpl { class CarpetOfFlowersTriggeredAbility extends TriggeredAbilityImpl { - public CarpetOfFlowersTriggeredAbility() { super(Zone.BATTLEFIELD, new CarpetOfFlowersEffect(), true); this.addChoice(new ChoiceColor()); this.addTarget(new TargetOpponent()); - } public CarpetOfFlowersTriggeredAbility(final CarpetOfFlowersTriggeredAbility ability) { @@ -94,11 +93,15 @@ class CarpetOfFlowersTriggeredAbility extends TriggeredAbilityImpl { return new CarpetOfFlowersTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.PRECOMBAT_MAIN_PHASE_PRE + || event.getType() == EventType.POSTCOMBAT_MAIN_PHASE_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return (event.getType() == GameEvent.EventType.PRECOMBAT_MAIN_PHASE_PRE - || event.getType() == GameEvent.EventType.POSTCOMBAT_MAIN_PHASE_PRE) - && event.getPlayerId().equals(this.controllerId); + return event.getPlayerId().equals(this.controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/urzassaga/DiabolicServitude.java b/Mage.Sets/src/mage/sets/urzassaga/DiabolicServitude.java index 7ed0e91116..b4fa874369 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/DiabolicServitude.java +++ b/Mage.Sets/src/mage/sets/urzassaga/DiabolicServitude.java @@ -47,6 +47,7 @@ import mage.constants.Zone; import mage.filter.common.FilterCreatureCard; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.target.common.TargetCardInYourGraveyard; import mage.target.targetpointer.FixedTarget; @@ -131,9 +132,14 @@ class DiabolicServitudeCreatureDiesTriggeredAbility extends TriggeredAbilityImpl return new DiabolicServitudeCreatureDiesTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) { + if (((ZoneChangeEvent)event).isDiesEvent()) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; Object object = game.getState().getValue(getSourceId().toString() + "returnedCreature"); if ((object instanceof MageObjectReference) && ((MageObjectReference)object).refersTo(zEvent.getTarget(), game)) { diff --git a/Mage.Sets/src/mage/sets/urzassaga/FertileGround.java b/Mage.Sets/src/mage/sets/urzassaga/FertileGround.java index d04f528929..f77cfd2fb8 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/FertileGround.java +++ b/Mage.Sets/src/mage/sets/urzassaga/FertileGround.java @@ -28,10 +28,8 @@ package mage.sets.urzassaga; import java.util.UUID; -import mage.Mana; import mage.abilities.Ability; import mage.abilities.effects.common.AddManaAnyColorAttachedControllerEffect; -import mage.abilities.effects.common.AddManaToManaPoolTargetControllerEffect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.keyword.EnchantAbility; import mage.abilities.mana.TriggeredManaAbility; @@ -42,6 +40,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; @@ -90,9 +89,13 @@ class FertileGroundTriggeredAbility extends TriggeredManaAbility { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED_FOR_MANA; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if(event.getType() == GameEvent.EventType.TAPPED_FOR_MANA){ Permanent enchantment = game.getPermanent(this.getSourceId()); if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) { Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); @@ -101,7 +104,6 @@ class FertileGroundTriggeredAbility extends TriggeredManaAbility { return true; } } - } return false; } diff --git a/Mage.Sets/src/mage/sets/urzassaga/GoblinLackey.java b/Mage.Sets/src/mage/sets/urzassaga/GoblinLackey.java index 2c40cec9c2..f4f44011f6 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/GoblinLackey.java +++ b/Mage.Sets/src/mage/sets/urzassaga/GoblinLackey.java @@ -28,20 +28,21 @@ package mage.sets.urzassaga; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterPermanentCard; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.common.TargetCardInHand; @@ -88,13 +89,15 @@ class GoblinLackeyTriggeredAbility extends TriggeredAbilityImpl { return new GoblinLackeyTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId) - && game.getOpponents(this.getControllerId()).contains(event.getTargetId())) { - return true; - } - return false; + return event.getSourceId().equals(this.sourceId) + && game.getOpponents(this.getControllerId()).contains(event.getTargetId()); } @Override diff --git a/Mage.Sets/src/mage/sets/urzassaga/SpreadingAlgae.java b/Mage.Sets/src/mage/sets/urzassaga/SpreadingAlgae.java index f5fcb1bdd7..3f944b98a2 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/SpreadingAlgae.java +++ b/Mage.Sets/src/mage/sets/urzassaga/SpreadingAlgae.java @@ -28,9 +28,6 @@ package mage.sets.urzassaga; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility; @@ -40,12 +37,15 @@ import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.ReturnToHandSourceEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterLandPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; @@ -108,15 +108,18 @@ class SpreadingAlgaeTriggeredAbility extends TriggeredAbilityImpl { return new SpreadingAlgaeTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TAPPED) { - Permanent enchant = game.getPermanent(sourceId); - if (enchant != null && enchant.getAttachedTo() != null) { - if (event.getTargetId().equals(enchant.getAttachedTo())) { - getEffects().get(0).setTargetPointer(new FixedTarget(enchant.getAttachedTo())); - return true; - } + Permanent enchant = game.getPermanent(sourceId); + if (enchant != null && enchant.getAttachedTo() != null) { + if (event.getTargetId().equals(enchant.getAttachedTo())) { + getEffects().get(0).setTargetPointer(new FixedTarget(enchant.getAttachedTo())); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/urzassaga/ThranQuarry.java b/Mage.Sets/src/mage/sets/urzassaga/ThranQuarry.java index 095bc4a333..73d17f664c 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/ThranQuarry.java +++ b/Mage.Sets/src/mage/sets/urzassaga/ThranQuarry.java @@ -28,17 +28,17 @@ package mage.sets.urzassaga; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.mana.AnyColorManaAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -83,15 +83,15 @@ class ThranQuarryTriggeredAbility extends TriggeredAbilityImpl { return new ThranQuarryTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE) { - FilterCreaturePermanent filter = new FilterCreaturePermanent(); - if (!game.getBattlefield().contains(filter, controllerId, 1, game)) { - return true; - } - } - return false; + FilterCreaturePermanent filter = new FilterCreaturePermanent(); + return !game.getBattlefield().contains(filter, controllerId, 1, game); } @Override diff --git a/Mage.Sets/src/mage/sets/urzassaga/TitaniasChosen.java b/Mage.Sets/src/mage/sets/urzassaga/TitaniasChosen.java index 98192bb6e6..59620af5ce 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/TitaniasChosen.java +++ b/Mage.Sets/src/mage/sets/urzassaga/TitaniasChosen.java @@ -30,12 +30,12 @@ package mage.sets.urzassaga; import java.util.UUID; import mage.MageInt; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; @@ -87,15 +87,15 @@ class TitaniasChosenAbility extends TriggeredAbilityImpl { return new TitaniasChosenAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).isGreen()) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getColor(game).isGreen(); } @Override diff --git a/Mage.Sets/src/mage/sets/vintagemasters/MarchesaTheBlackRose.java b/Mage.Sets/src/mage/sets/vintagemasters/MarchesaTheBlackRose.java index 8c08e541ee..ad1d7340d1 100644 --- a/Mage.Sets/src/mage/sets/vintagemasters/MarchesaTheBlackRose.java +++ b/Mage.Sets/src/mage/sets/vintagemasters/MarchesaTheBlackRose.java @@ -50,6 +50,7 @@ import mage.counters.CounterType; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -107,10 +108,14 @@ class MarchesaTheBlackRoseTriggeredAbility extends TriggeredAbilityImpl { return new MarchesaTheBlackRoseTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE - && ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD + if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD && ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (permanent != null && diff --git a/Mage.Sets/src/mage/sets/vintagemasters/ScourgeOfTheThrone.java b/Mage.Sets/src/mage/sets/vintagemasters/ScourgeOfTheThrone.java index c58c72fd7b..77362f4321 100644 --- a/Mage.Sets/src/mage/sets/vintagemasters/ScourgeOfTheThrone.java +++ b/Mage.Sets/src/mage/sets/vintagemasters/ScourgeOfTheThrone.java @@ -36,7 +36,6 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.UntapAllControllerEffect; import mage.abilities.keyword.DethroneAbility; import mage.abilities.keyword.FlyingAbility; -import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; @@ -70,7 +69,7 @@ public class ScourgeOfTheThrone extends CardImpl { // Dethrone (Whenever this creature attacks the player with the most life or tied for most life, put a +1/+1 counter on it.) this.addAbility(new DethroneAbility()); // Whenever Scourge of the Throne attacks for the first time each turn, if it's attacking the player with the most life or tied for most life, untap all attacking creatures. After this phase, there is an additional combat phase. - Ability ability = new ScourgeOfTheThroneAttacksTriggeredAbility(new UntapAllControllerEffect(new FilterControlledCreaturePermanent(),"untap all creatures you control"), false); + Ability ability = new ScourgeOfTheThroneAttacksTriggeredAbility(new UntapAllControllerEffect(new FilterControlledCreaturePermanent(), "untap all creatures you control"), false); ability.addEffect(new AdditionalCombatPhaseEffect()); this.addAbility(ability); } @@ -108,7 +107,7 @@ class ScourgeOfTheThroneAttacksTriggeredAbility extends TriggeredAbilityImpl { Player controller = game.getPlayer(getControllerId()); if (attackedPlayer != null && controller != null) { int mostLife = Integer.MIN_VALUE; - for (UUID playerId: controller.getInRange()) { + for (UUID playerId : controller.getInRange()) { Player player = game.getPlayer(playerId); if (player != null) { if (player.getLife() > mostLife) { @@ -122,53 +121,58 @@ class ScourgeOfTheThroneAttacksTriggeredAbility extends TriggeredAbilityImpl { return false; } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId()) ) { - Integer amountAttacks = (Integer) game.getState().getValue(CardUtil.getCardZoneString("amountAttacks", getSourceId(), game)); - if (amountAttacks == null || amountAttacks.intValue() < 1) { - if (amountAttacks == null) { - amountAttacks = new Integer(1); - } else { - ++amountAttacks; - } - game.getState().setValue(CardUtil.getCardZoneString("amountAttacks", getSourceId(), game), amountAttacks); - return true; - } - } - return false; + if (event.getSourceId().equals(this.getSourceId())) { + Integer amountAttacks = (Integer) game.getState().getValue(CardUtil.getCardZoneString("amountAttacks", getSourceId(), game)); + if (amountAttacks == null || amountAttacks.intValue() < 1) { + if (amountAttacks == null) { + amountAttacks = new Integer(1); + } else { + ++amountAttacks; + } + game.getState().setValue(CardUtil.getCardZoneString("amountAttacks", getSourceId(), game), amountAttacks); + return true; + } + } + return false; } @Override public String getRule() { - return "Whenever {this} attacks for the first time each turn, if it's attacking the player with the most life or tied for most life, " + super.getRule(); + return "Whenever {this} attacks for the first time each turn, if it's attacking the player with the most life or tied for most life, " + super.getRule(); } @Override public ScourgeOfTheThroneAttacksTriggeredAbility copy() { - return new ScourgeOfTheThroneAttacksTriggeredAbility(this); + return new ScourgeOfTheThroneAttacksTriggeredAbility(this); } } class AdditionalCombatPhaseEffect extends OneShotEffect { public AdditionalCombatPhaseEffect() { - super(Outcome.Benefit); - staticText = "After this phase, there is an additional combat phase"; + super(Outcome.Benefit); + staticText = "After this phase, there is an additional combat phase"; } public AdditionalCombatPhaseEffect(final AdditionalCombatPhaseEffect effect) { - super(effect); + super(effect); } @Override public AdditionalCombatPhaseEffect copy() { - return new AdditionalCombatPhaseEffect(this); + return new AdditionalCombatPhaseEffect(this); } @Override public boolean apply(Game game, Ability source) { - game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), TurnPhase.COMBAT, null, false)); - return true; + game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), TurnPhase.COMBAT, null, false)); + return true; } } diff --git a/Mage.Sets/src/mage/sets/vintagemasters/SpinalGraft.java b/Mage.Sets/src/mage/sets/vintagemasters/SpinalGraft.java index 5ef23730e2..b6b24c31bb 100644 --- a/Mage.Sets/src/mage/sets/vintagemasters/SpinalGraft.java +++ b/Mage.Sets/src/mage/sets/vintagemasters/SpinalGraft.java @@ -42,6 +42,7 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; @@ -95,17 +96,20 @@ class SpinalGraftTriggeredAbility extends TriggeredAbilityImpl { public SpinalGraftTriggeredAbility copy() { return new SpinalGraftTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TARGETED; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TARGETED) { - Permanent enchantment = game.getPermanent(sourceId); - if (enchantment != null && enchantment.getAttachedTo() != null) { - UUID enchanted = enchantment.getAttachedTo(); - if (event.getTargetId().equals(enchanted)) { - getEffects().get(0).setTargetPointer(new FixedTarget(enchanted)); - return true; - } + Permanent enchantment = game.getPermanent(sourceId); + if (enchantment != null && enchantment.getAttachedTo() != null) { + UUID enchanted = enchantment.getAttachedTo(); + if (event.getTargetId().equals(enchanted)) { + getEffects().get(0).setTargetPointer(new FixedTarget(enchanted)); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/visions/Necromancy.java b/Mage.Sets/src/mage/sets/visions/Necromancy.java index 3c4b60e43d..0525df83ff 100644 --- a/Mage.Sets/src/mage/sets/visions/Necromancy.java +++ b/Mage.Sets/src/mage/sets/visions/Necromancy.java @@ -59,6 +59,7 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.PermanentIdPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.stack.Spell; import mage.players.Player; @@ -151,16 +152,19 @@ class CastAtInstantTimeTriggeredAbility extends TriggeredAbilityImpl { return new CastAtInstantTimeTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { // The sacrifice occurs only if you cast it using its own ability. If you cast it using some other // effect (for instance, if it gained flash from Vedalken Orrery), then it won't be sacrificed. // CHECK - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getSourceId().equals(getSourceId())) { - return !(game.isMainPhase() && game.getActivePlayerId().equals(event.getPlayerId()) && game.getStack().size() == 1); - } + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null && spell.getSourceId().equals(getSourceId())) { + return !(game.isMainPhase() && game.getActivePlayerId().equals(event.getPlayerId()) && game.getStack().size() == 1); } return false; } diff --git a/Mage.Sets/src/mage/sets/weatherlight/GoblinVandal.java b/Mage.Sets/src/mage/sets/weatherlight/GoblinVandal.java index 9e2dee19eb..055cd37768 100644 --- a/Mage.Sets/src/mage/sets/weatherlight/GoblinVandal.java +++ b/Mage.Sets/src/mage/sets/weatherlight/GoblinVandal.java @@ -46,6 +46,7 @@ import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.combat.CombatGroup; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.Target; import mage.target.TargetPermanent; @@ -101,20 +102,23 @@ class GoblinVandalTriggeredAbility extends TriggeredAbilityImpl { return new GoblinVandalTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DECLARED_BLOCKERS; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DECLARED_BLOCKERS) { - Permanent sourcePermanent = game.getPermanent(getSourceId()); - if (sourcePermanent.isAttacking()) { - for (CombatGroup combatGroup: game.getCombat().getGroups()) { - if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) { - UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(getSourceId(), game); - FilterPermanent filter = new FilterArtifactPermanent(); - filter.add(new ControllerIdPredicate(defendingPlayerId)); - Target target = new TargetPermanent(filter); - this.addTarget(target); - return true; - } + Permanent sourcePermanent = game.getPermanent(getSourceId()); + if (sourcePermanent.isAttacking()) { + for (CombatGroup combatGroup: game.getCombat().getGroups()) { + if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) { + UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(getSourceId(), game); + FilterPermanent filter = new FilterArtifactPermanent(); + filter.add(new ControllerIdPredicate(defendingPlayerId)); + Target target = new TargetPermanent(filter); + this.addTarget(target); + return true; } } } diff --git a/Mage.Sets/src/mage/sets/worldwake/AmuletOfVigor.java b/Mage.Sets/src/mage/sets/worldwake/AmuletOfVigor.java index 3a35b6b1e1..8ac3bdf798 100644 --- a/Mage.Sets/src/mage/sets/worldwake/AmuletOfVigor.java +++ b/Mage.Sets/src/mage/sets/worldwake/AmuletOfVigor.java @@ -28,15 +28,16 @@ package mage.sets.worldwake; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.UntapTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; @@ -76,16 +77,19 @@ class AmuletOfVigorTriggeredAbility extends TriggeredAbilityImpl { return new AmuletOfVigorTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - Permanent p = game.getPermanent(event.getTargetId()); - if (p != null && p.isTapped() && p.getControllerId().equals(this.controllerId)) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - } - return true; + Permanent p = game.getPermanent(event.getTargetId()); + if (p != null && p.isTapped() && p.getControllerId().equals(this.controllerId)) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/worldwake/ArchonOfRedemption.java b/Mage.Sets/src/mage/sets/worldwake/ArchonOfRedemption.java index fb6b00709c..b7130eab48 100644 --- a/Mage.Sets/src/mage/sets/worldwake/ArchonOfRedemption.java +++ b/Mage.Sets/src/mage/sets/worldwake/ArchonOfRedemption.java @@ -28,9 +28,6 @@ package mage.sets.worldwake; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -38,10 +35,13 @@ import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -88,20 +88,23 @@ class ArchonOfRedemptionTriggeredAbility extends TriggeredAbilityImpl { return new ArchonOfRedemptionTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - UUID targetId = event.getTargetId(); - Permanent permanent = game.getPermanent(targetId); - if (permanent.getControllerId().equals(this.controllerId) - && permanent.getCardType().contains(CardType.CREATURE) - && (targetId.equals(this.getSourceId()) - || (permanent.getAbilities().contains(FlyingAbility.getInstance()) && !targetId.equals(this.getSourceId())))) { - for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getTargetId())); - } - return true; + UUID targetId = event.getTargetId(); + Permanent permanent = game.getPermanent(targetId); + if (permanent.getControllerId().equals(this.controllerId) + && permanent.getCardType().contains(CardType.CREATURE) + && (targetId.equals(this.getSourceId()) + || (permanent.getAbilities().contains(FlyingAbility.getInstance()) && !targetId.equals(this.getSourceId())))) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); } + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/worldwake/BrinkOfDisaster.java b/Mage.Sets/src/mage/sets/worldwake/BrinkOfDisaster.java index 039cd486a6..bb646a302a 100644 --- a/Mage.Sets/src/mage/sets/worldwake/BrinkOfDisaster.java +++ b/Mage.Sets/src/mage/sets/worldwake/BrinkOfDisaster.java @@ -28,21 +28,21 @@ package mage.sets.worldwake; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.targetpointer.FixedTarget; @@ -101,15 +101,18 @@ class EnchantedBecomesTappedTriggeredAbility extends TriggeredAbilityImpl { return new EnchantedBecomesTappedTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.TAPPED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.TAPPED) { - Permanent enchant = game.getPermanent(sourceId); - if (enchant != null && enchant.getAttachedTo() != null) { - if (event.getTargetId().equals(enchant.getAttachedTo())) { - getEffects().get(0).setTargetPointer(new FixedTarget(enchant.getAttachedTo())); - return true; - } + Permanent enchant = game.getPermanent(sourceId); + if (enchant != null && enchant.getAttachedTo() != null) { + if (event.getTargetId().equals(enchant.getAttachedTo())) { + getEffects().get(0).setTargetPointer(new FixedTarget(enchant.getAttachedTo())); + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/worldwake/HammerOfRuin.java b/Mage.Sets/src/mage/sets/worldwake/HammerOfRuin.java index 12d98026bf..3679a0f0c9 100644 --- a/Mage.Sets/src/mage/sets/worldwake/HammerOfRuin.java +++ b/Mage.Sets/src/mage/sets/worldwake/HammerOfRuin.java @@ -29,11 +29,6 @@ package mage.sets.worldwake; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; @@ -41,12 +36,17 @@ import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.continuous.BoostEquippedEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; @@ -96,20 +96,23 @@ class HammerOfRuinTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - Permanent p = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { - FilterPermanent filter = new FilterPermanent("Equipment that player controls"); - filter.add(new SubtypePredicate("Equipment")); - filter.add(new ControllerIdPredicate(event.getPlayerId())); - filter.setMessage("creature controlled by " + game.getPlayer(event.getTargetId()).getLogName()); + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } - this.getTargets().clear(); - this.addTarget(new TargetPermanent(filter)); - return true; - } + @Override + public boolean checkTrigger(GameEvent event, Game game) { + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + Permanent p = game.getPermanent(event.getSourceId()); + if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { + FilterPermanent filter = new FilterPermanent("Equipment that player controls"); + filter.add(new SubtypePredicate("Equipment")); + filter.add(new ControllerIdPredicate(event.getPlayerId())); + filter.setMessage("creature controlled by " + game.getPlayer(event.getTargetId()).getLogName()); + + this.getTargets().clear(); + this.addTarget(new TargetPermanent(filter)); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/worldwake/KalastriaHighborn.java b/Mage.Sets/src/mage/sets/worldwake/KalastriaHighborn.java index 4a762bce95..77c4170661 100644 --- a/Mage.Sets/src/mage/sets/worldwake/KalastriaHighborn.java +++ b/Mage.Sets/src/mage/sets/worldwake/KalastriaHighborn.java @@ -27,15 +27,16 @@ */ package mage.sets.worldwake; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; +import java.util.UUID; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -43,8 +44,6 @@ import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.target.TargetPlayer; -import java.util.UUID; - /** * * @author maurer.it_at_gmail.com @@ -91,14 +90,16 @@ class KalastriaHighbornTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if ( event.getType() == EventType.ZONE_CHANGE ) { + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override + public boolean checkTrigger(GameEvent event, Game game) { // ayrat: make sure Kalastria Highborn is on battlefield - UUID sourceId = getSourceId(); - if (game.getPermanent(sourceId) == null) { + if (game.getPermanent(this.getSourceId()) == null) { // or it is being removed - if (game.getLastKnownInformation(sourceId, Zone.BATTLEFIELD) == null) { + if (game.getLastKnownInformation(this.getSourceId(), Zone.BATTLEFIELD) == null) { return false; } } @@ -106,16 +107,11 @@ class KalastriaHighbornTriggeredAbility extends TriggeredAbilityImpl { ZoneChangeEvent zEvent = (ZoneChangeEvent)event; Permanent permanent = zEvent.getTarget(); - if (permanent != null && + return permanent != null && zEvent.getToZone() == Zone.GRAVEYARD && zEvent.getFromZone() == Zone.BATTLEFIELD && (permanent.getControllerId().equals(this.getControllerId()) && - permanent.hasSubtype("Vampire") || permanent.getId().equals(this.getSourceId()))) - { - return true; - } - } - return false; + permanent.hasSubtype("Vampire") || permanent.getId().equals(this.getSourceId())); } @Override diff --git a/Mage.Sets/src/mage/sets/worldwake/KazuulTyrantOfTheCliffs.java b/Mage.Sets/src/mage/sets/worldwake/KazuulTyrantOfTheCliffs.java index 851dfe2e56..347d2cc3cd 100644 --- a/Mage.Sets/src/mage/sets/worldwake/KazuulTyrantOfTheCliffs.java +++ b/Mage.Sets/src/mage/sets/worldwake/KazuulTyrantOfTheCliffs.java @@ -28,9 +28,6 @@ package mage.sets.worldwake; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -38,10 +35,13 @@ import mage.abilities.costs.Cost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.permanent.token.Token; import mage.players.Player; @@ -92,17 +92,19 @@ class KazuulTyrantOfTheCliffsTriggeredAbility extends TriggeredAbilityImpl { return new KazuulTyrantOfTheCliffsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) { - Permanent attacker = game.getPermanent(event.getSourceId()); - Player defender = game.getPlayer(event.getTargetId()); - Player you = game.getPlayer(controllerId); - if (attacker.getControllerId() != you.getId() - && defender == you) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(attacker.getControllerId())); - return true; - } + Permanent attacker = game.getPermanent(event.getSourceId()); + Player defender = game.getPlayer(event.getTargetId()); + Player you = game.getPlayer(controllerId); + if (attacker.getControllerId() != you.getId() && defender == you) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(attacker.getControllerId())); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/worldwake/KorFirewalker.java b/Mage.Sets/src/mage/sets/worldwake/KorFirewalker.java index 9e46e536a4..3b4e0eabd7 100644 --- a/Mage.Sets/src/mage/sets/worldwake/KorFirewalker.java +++ b/Mage.Sets/src/mage/sets/worldwake/KorFirewalker.java @@ -29,19 +29,20 @@ package mage.sets.worldwake; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.ObjectColor; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.keyword.ProtectionAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; /** @@ -96,15 +97,15 @@ class KorFirewalkerAbility extends TriggeredAbilityImpl { return new KorFirewalkerAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getColor(game).isRed()) { - return true; - } - } - return false; + Spell spell = game.getStack().getSpell(event.getTargetId()); + return spell != null && spell.getColor(game).isRed(); } @Override diff --git a/Mage.Sets/src/mage/sets/worldwake/PerimeterCaptain.java b/Mage.Sets/src/mage/sets/worldwake/PerimeterCaptain.java index af06de30b3..673cb6f061 100644 --- a/Mage.Sets/src/mage/sets/worldwake/PerimeterCaptain.java +++ b/Mage.Sets/src/mage/sets/worldwake/PerimeterCaptain.java @@ -28,18 +28,18 @@ package mage.sets.worldwake; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.keyword.DefenderAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; /** @@ -84,14 +84,17 @@ class PerimeterCaptainTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BLOCKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) { - Permanent creature = game.getPermanent(event.getSourceId()); - if (creature != null) { - if (creature.getControllerId().equals(this.getControllerId()) && creature.getAbilities().contains(DefenderAbility.getInstance())) { - return true; - } + Permanent creature = game.getPermanent(event.getSourceId()); + if (creature != null) { + if (creature.getControllerId().equals(this.getControllerId()) && creature.getAbilities().contains(DefenderAbility.getInstance())) { + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/worldwake/QuestForTheNihilStone.java b/Mage.Sets/src/mage/sets/worldwake/QuestForTheNihilStone.java index bb0c450044..6d45d2c7d5 100644 --- a/Mage.Sets/src/mage/sets/worldwake/QuestForTheNihilStone.java +++ b/Mage.Sets/src/mage/sets/worldwake/QuestForTheNihilStone.java @@ -28,15 +28,14 @@ package mage.sets.worldwake; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; @@ -88,12 +87,14 @@ class QuestForTheNihilStoneTriggeredAbility extends TriggeredAbilityImpl { return new QuestForTheNihilStoneTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DISCARDED_CARD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.DISCARDED_CARD && game.getOpponents(controllerId).contains(event.getPlayerId())) { - return true; - } - return false; + return game.getOpponents(controllerId).contains(event.getPlayerId()); } @Override @@ -117,6 +118,11 @@ class QuestForTheNihilStoneTriggeredAbility2 extends TriggeredAbilityImpl { return new QuestForTheNihilStoneTriggeredAbility2(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent quest = game.getPermanent(super.getSourceId()); @@ -124,7 +130,7 @@ class QuestForTheNihilStoneTriggeredAbility2 extends TriggeredAbilityImpl { Permanent questLKI = (Permanent) game.getLastKnownInformation(super.getSourceId(), Zone.BATTLEFIELD); quest = questLKI; } - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && game.getOpponents(controllerId).contains(event.getPlayerId())) { + if (game.getOpponents(controllerId).contains(event.getPlayerId())) { Player opponent = game.getPlayer(event.getPlayerId()); if (opponent != null && opponent.getHand().size() == 0 diff --git a/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java b/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java index 9699ac7380..0a35620815 100644 --- a/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java +++ b/Mage.Sets/src/mage/sets/worldwake/QuestForUlasTemple.java @@ -28,8 +28,6 @@ package mage.sets.worldwake; import java.util.UUID; - -import mage.constants.*; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; @@ -38,12 +36,18 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCardInHand; @@ -131,12 +135,14 @@ class QuestForUlasTempleTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(GameEvent.EventType.END_TURN_STEP_PRE)) { - Permanent quest = game.getPermanent(super.getSourceId()); - return quest != null && quest.getCounters().getCount(CounterType.QUEST) >= 3; - } - return false; + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + + @Override +public boolean checkTrigger(GameEvent event, Game game) { + Permanent quest = game.getPermanent(super.getSourceId()); + return quest != null && quest.getCounters().getCount(CounterType.QUEST) >= 3; } @Override diff --git a/Mage.Sets/src/mage/sets/worldwake/RumblingAftershocks.java b/Mage.Sets/src/mage/sets/worldwake/RumblingAftershocks.java index 00283f78fe..3a4894f321 100644 --- a/Mage.Sets/src/mage/sets/worldwake/RumblingAftershocks.java +++ b/Mage.Sets/src/mage/sets/worldwake/RumblingAftershocks.java @@ -28,21 +28,21 @@ package mage.sets.worldwake; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.TargetController; -import mage.constants.Zone; -import mage.abilities.Abilities; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.KickerAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.game.stack.Spell; import mage.players.Player; @@ -98,21 +98,23 @@ class RumblingAftershocksTriggeredAbility extends TriggeredAbilityImpl { } @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.SPELL_CAST) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && spell.getControllerId().equals(controllerId)) { - int damageAmount = 0; - for (Ability ability: (Abilities) spell.getAbilities()) { - if (ability instanceof KickerAbility) { - damageAmount += ((KickerAbility) ability).getKickedCounter(game); - } - } - if (damageAmount > 0) { - this.getEffects().get(0).setValue("damageAmount", new Integer(damageAmount)); - return true; - } + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.SPELL_CAST; + } + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null && spell.getControllerId().equals(controllerId)) { + int damageAmount = 0; + for (Ability ability: spell.getAbilities()) { + if (ability instanceof KickerAbility) { + damageAmount += ((KickerAbility) ability).getKickedCounter(game); + } + } + if (damageAmount > 0) { + this.getEffects().get(0).setValue("damageAmount", damageAmount); + return true; } } return false; @@ -144,15 +146,15 @@ class RumblingAftershocksDealDamageEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); Integer damageAmount = (Integer) this.getValue("damageAmount"); - if (player != null && damageAmount.intValue() > 0) { + if (player != null && damageAmount > 0) { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer != null) { - targetPlayer.damage(damageAmount.intValue(), source.getSourceId(), game, false, true); + targetPlayer.damage(damageAmount, source.getSourceId(), game, false, true); return true; } Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent != null) { - permanent.damage(damageAmount.intValue(), source.getSourceId(), game, false, true); + permanent.damage(damageAmount, source.getSourceId(), game, false, true); return true; } } diff --git a/Mage.Sets/src/mage/sets/worldwake/SlaveringNulls.java b/Mage.Sets/src/mage/sets/worldwake/SlaveringNulls.java index 2a4d6737de..ff4e630dbe 100644 --- a/Mage.Sets/src/mage/sets/worldwake/SlaveringNulls.java +++ b/Mage.Sets/src/mage/sets/worldwake/SlaveringNulls.java @@ -28,20 +28,20 @@ package mage.sets.worldwake; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterControlledLandPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.targetpointer.FixedTarget; @@ -96,10 +96,14 @@ class SlaveringNullsTriggeredAbility extends TriggeredAbilityImpl { return new SlaveringNullsTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId) - && ((DamagedPlayerEvent) event).isCombatDamage()) { + if (event.getSourceId().equals(this.sourceId) && ((DamagedPlayerEvent) event).isCombatDamage()) { if (game.getBattlefield().countAll(filter, controllerId, game) > 0) { Permanent slaveringNulls = game.getPermanent(event.getSourceId()); Player player = game.getPlayer(event.getTargetId()); diff --git a/Mage.Sets/src/mage/sets/worldwake/TalusPaladin.java b/Mage.Sets/src/mage/sets/worldwake/TalusPaladin.java index f3e07b654b..792062bd19 100644 --- a/Mage.Sets/src/mage/sets/worldwake/TalusPaladin.java +++ b/Mage.Sets/src/mage/sets/worldwake/TalusPaladin.java @@ -28,11 +28,6 @@ package mage.sets.worldwake; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -40,12 +35,17 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.abilities.keyword.LifelinkAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; @@ -101,18 +101,21 @@ class TalusPaladinTriggeredAbility extends TriggeredAbilityImpl { public TalusPaladinTriggeredAbility copy() { return new TalusPaladinTriggeredAbility(this); } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - Permanent ally = game.getPermanent(event.getTargetId()); - if (ally != null) { - if (ally.hasSubtype("Ally") - && ally.getControllerId().equals(this.getControllerId())) { - if (event.getTargetId().equals(this.getSourceId()) - || event.getTargetId().equals(ally.getId())) { - return true; - } + Permanent ally = game.getPermanent(event.getTargetId()); + if (ally != null) { + if (ally.hasSubtype("Ally") + && ally.getControllerId().equals(this.getControllerId())) { + if (event.getTargetId().equals(this.getSourceId()) + || event.getTargetId().equals(ally.getId())) { + return true; } } } diff --git a/Mage.Sets/src/mage/sets/zendikar/BladeOfTheBloodchief.java b/Mage.Sets/src/mage/sets/zendikar/BladeOfTheBloodchief.java index f2a9cbaa96..1d58f3eca4 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BladeOfTheBloodchief.java +++ b/Mage.Sets/src/mage/sets/zendikar/BladeOfTheBloodchief.java @@ -28,17 +28,16 @@ package mage.sets.zendikar; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; @@ -52,7 +51,7 @@ import mage.game.permanent.Permanent; */ public class BladeOfTheBloodchief extends CardImpl { - public BladeOfTheBloodchief ( UUID ownerId ) { + public BladeOfTheBloodchief(UUID ownerId) { super(ownerId, 196, "Blade of the Bloodchief", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{1}"); this.expansionSetCode = "ZEN"; this.getSubtype().add("Equipment"); @@ -76,25 +75,28 @@ class BladeOfTheBloodChiefTriggeredAbility extends TriggeredAbilityImpl { private static final String text = "Whenever a creature dies, put a +1/+1 counter on equipped " + "creature. If equipped creature is a Vampire, put two +1/+1 counters on it instead."; - BladeOfTheBloodChiefTriggeredAbility ( ) { + BladeOfTheBloodChiefTriggeredAbility() { super(Zone.BATTLEFIELD, new BladeOfTheBloodchiefEffect()); } - BladeOfTheBloodChiefTriggeredAbility ( final BladeOfTheBloodChiefTriggeredAbility ability ) { + BladeOfTheBloodChiefTriggeredAbility(final BladeOfTheBloodChiefTriggeredAbility ability) { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if ( event.getType() == EventType.ZONE_CHANGE ) { - ZoneChangeEvent zEvent = (ZoneChangeEvent)event; - if ( zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD ) { - Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (p != null && p.getCardType().contains(CardType.CREATURE)) { - Permanent enchantment = game.getPermanent(getSourceId()); - if (enchantment != null && enchantment.getAttachedTo() != null) { - return true; - } + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { + Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + if (p != null && p.getCardType().contains(CardType.CREATURE)) { + Permanent enchantment = game.getPermanent(getSourceId()); + if (enchantment != null && enchantment.getAttachedTo() != null) { + return true; } } } @@ -114,11 +116,11 @@ class BladeOfTheBloodChiefTriggeredAbility extends TriggeredAbilityImpl { class BladeOfTheBloodchiefEffect extends OneShotEffect { - BladeOfTheBloodchiefEffect ( ) { + BladeOfTheBloodchiefEffect() { super(Outcome.BoostCreature); } - BladeOfTheBloodchiefEffect ( final BladeOfTheBloodchiefEffect ability ) { + BladeOfTheBloodchiefEffect(final BladeOfTheBloodchiefEffect ability) { super(ability); } @@ -128,10 +130,9 @@ class BladeOfTheBloodchiefEffect extends OneShotEffect { if (enchantment != null && enchantment.getAttachedTo() != null) { Permanent creature = game.getPermanent(enchantment.getAttachedTo()); if (creature != null) { - if ( creature.hasSubtype("Vampire") ) { + if (creature.hasSubtype("Vampire")) { creature.addCounters(CounterType.P1P1.createInstance(2), game); - } - else { + } else { creature.addCounters(CounterType.P1P1.createInstance(), game); } } diff --git a/Mage.Sets/src/mage/sets/zendikar/BloodSeeker.java b/Mage.Sets/src/mage/sets/zendikar/BloodSeeker.java index f017bba3d9..ec453fe937 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BloodSeeker.java +++ b/Mage.Sets/src/mage/sets/zendikar/BloodSeeker.java @@ -28,18 +28,19 @@ package mage.sets.zendikar; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.abilities.effects.common.LoseLifeTargetEffect; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.targetpointer.FixedTarget; /** @@ -72,6 +73,7 @@ public class BloodSeeker extends CardImpl { } class BloodSeekerTriggeredAbility extends TriggeredAbilityImpl { + BloodSeekerTriggeredAbility() { super(Zone.BATTLEFIELD, new LoseLifeTargetEffect(1), true); } @@ -85,14 +87,19 @@ class BloodSeekerTriggeredAbility extends TriggeredAbilityImpl { return new BloodSeekerTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && game.getOpponents(this.controllerId).contains(event.getPlayerId())) { + if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) { EntersTheBattlefieldEvent zEvent = (EntersTheBattlefieldEvent) event; Card card = zEvent.getTarget(); if (card != null && card.getCardType().contains(CardType.CREATURE)) { for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } return true; } @@ -104,4 +111,4 @@ class BloodSeekerTriggeredAbility extends TriggeredAbilityImpl { public String getRule() { return "Whenever a creature enters the battlefield under an opponent's control, you may have that player lose 1 life."; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/zendikar/CelestialMantle.java b/Mage.Sets/src/mage/sets/zendikar/CelestialMantle.java index 5dfe4bbde0..a4fc194533 100644 --- a/Mage.Sets/src/mage/sets/zendikar/CelestialMantle.java +++ b/Mage.Sets/src/mage/sets/zendikar/CelestialMantle.java @@ -29,8 +29,6 @@ package mage.sets.zendikar; import java.util.UUID; - -import mage.constants.*; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; @@ -40,9 +38,15 @@ import mage.abilities.effects.common.UntapAllLandsControllerEffect; import mage.abilities.effects.common.continuous.BoostEnchantedEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; @@ -96,16 +100,16 @@ class CelestialMantleAbility extends TriggeredAbilityImpl { return new CelestialMantleAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event instanceof DamagedPlayerEvent) { - DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; - Permanent p = game.getPermanent(event.getSourceId()); - if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) { - return true; - } - } - return false; + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + Permanent p = game.getPermanent(event.getSourceId()); + return damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId()); } @Override diff --git a/Mage.Sets/src/mage/sets/zendikar/CosisTrickster.java b/Mage.Sets/src/mage/sets/zendikar/CosisTrickster.java index 8a72b543e5..85e33e70ec 100644 --- a/Mage.Sets/src/mage/sets/zendikar/CosisTrickster.java +++ b/Mage.Sets/src/mage/sets/zendikar/CosisTrickster.java @@ -28,16 +28,17 @@ package mage.sets.zendikar; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -82,12 +83,14 @@ class CosisTricksterTriggeredAbility extends TriggeredAbilityImpl { return new CosisTricksterTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.LIBRARY_SHUFFLED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.LIBRARY_SHUFFLED && game.getOpponents(controllerId).contains(event.getPlayerId())) { - return true; - } - return false; + return game.getOpponents(controllerId).contains(event.getPlayerId()); } @Override diff --git a/Mage.Sets/src/mage/sets/zendikar/Electropotence.java b/Mage.Sets/src/mage/sets/zendikar/Electropotence.java index 3444242e8d..dd00e4e921 100644 --- a/Mage.Sets/src/mage/sets/zendikar/Electropotence.java +++ b/Mage.Sets/src/mage/sets/zendikar/Electropotence.java @@ -28,18 +28,19 @@ package mage.sets.zendikar; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.ManaCosts; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCreatureOrPlayer; @@ -81,15 +82,18 @@ class ElectropotenceTriggeredAbility extends TriggeredAbilityImpl { super(ability); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { - Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) - && permanent.getControllerId().equals(this.controllerId)) { - this.getEffects().get(0).setValue("damageSource", event.getTargetId()); - return true; - } + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) + && permanent.getControllerId().equals(this.controllerId)) { + this.getEffects().get(0).setValue("damageSource", event.getTargetId()); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/zendikar/EmeriaTheSkyRuin.java b/Mage.Sets/src/mage/sets/zendikar/EmeriaTheSkyRuin.java index 24025221f2..96294e0af5 100644 --- a/Mage.Sets/src/mage/sets/zendikar/EmeriaTheSkyRuin.java +++ b/Mage.Sets/src/mage/sets/zendikar/EmeriaTheSkyRuin.java @@ -27,23 +27,23 @@ */ package mage.sets.zendikar; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; +import java.util.UUID; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; import mage.abilities.mana.WhiteManaAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterLandPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCardInYourGraveyard; -import java.util.UUID; - /** * * @author North @@ -95,12 +95,14 @@ class EmeriaTheSkyRuinTriggeredAbility extends TriggeredAbilityImpl { return new EmeriaTheSkyRuinTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { - return true; - } - return false; + return event.getPlayerId().equals(this.controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/zendikar/GoblinGuide.java b/Mage.Sets/src/mage/sets/zendikar/GoblinGuide.java index ffe3e4e5b5..8f07a34ec0 100644 --- a/Mage.Sets/src/mage/sets/zendikar/GoblinGuide.java +++ b/Mage.Sets/src/mage/sets/zendikar/GoblinGuide.java @@ -29,10 +29,6 @@ package mage.sets.zendikar; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -44,6 +40,10 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.Cards; import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -101,9 +101,14 @@ class GoblinGuideTriggeredAbility extends TriggeredAbilityImpl { this.text = ability.text; } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ATTACKER_DECLARED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId()) ) { + if (event.getSourceId().equals(this.getSourceId()) ) { UUID defenderId = game.getCombat().getDefendingPlayerId(getSourceId(), game); if (defenderId != null) { for (Effect effect :this.getEffects()) { diff --git a/Mage.Sets/src/mage/sets/zendikar/LullmageMentor.java b/Mage.Sets/src/mage/sets/zendikar/LullmageMentor.java index 1e94eea0de..2721b3b5b3 100644 --- a/Mage.Sets/src/mage/sets/zendikar/LullmageMentor.java +++ b/Mage.Sets/src/mage/sets/zendikar/LullmageMentor.java @@ -30,10 +30,6 @@ package mage.sets.zendikar; import java.util.HashMap; import java.util.Map; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -42,7 +38,10 @@ import mage.abilities.costs.common.TapTargetCost; import mage.abilities.effects.common.CounterTargetEffect; import mage.abilities.effects.common.CreateTokenEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.constants.WatcherScope; +import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.SubtypePredicate; @@ -111,16 +110,16 @@ class LullmageMentorTriggeredAbility extends TriggeredAbilityImpl { return new LullmageMentorTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.COUNTERED; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.COUNTERED) { - CastedSpellsWithSpellTarget watcher = (CastedSpellsWithSpellTarget) game.getState().getWatchers().get("CastedSpellsWithSpellTarget"); - UUID controllerIdCounter = watcher.getControllerSpell(event.getSourceId(), event.getTargetId()); - if (controllerIdCounter != null && controllerIdCounter.equals(controllerId)) { - return true; - } - } - return false; + CastedSpellsWithSpellTarget watcher = (CastedSpellsWithSpellTarget) game.getState().getWatchers().get("CastedSpellsWithSpellTarget"); + UUID controllerIdCounter = watcher.getControllerSpell(event.getSourceId(), event.getTargetId()); + return controllerIdCounter != null && controllerIdCounter.equals(controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java b/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java index 953489a3b3..5464750d43 100644 --- a/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java +++ b/Mage.Sets/src/mage/sets/zendikar/LuminarchAscension.java @@ -28,10 +28,6 @@ package mage.sets.zendikar; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleActivatedAbility; @@ -42,9 +38,13 @@ import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.token.AngelToken; import mage.watchers.common.PlayerLostLifeWatcher; @@ -53,17 +53,16 @@ import mage.watchers.common.PlayerLostLifeWatcher; * @author jeffwadsworth */ public class LuminarchAscension extends CardImpl { - + private String rule = "At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on Luminarch Ascension. (Damage causes loss of life.)"; - + public LuminarchAscension(UUID ownerId) { super(ownerId, 25, "Luminarch Ascension", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); this.expansionSetCode = "ZEN"; - // At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on Luminarch Ascension. this.addAbility(new ConditionalTriggeredAbility(new LuminarchAscensionTriggeredAbility(), YouLostNoLifeThisTurnCondition.getInstance(), rule, true)); - + // {1}{W}: Put a 4/4 white Angel creature token with flying onto the battlefield. Activate this ability only if Luminarch Ascension has four or more quest counters on it. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new AngelToken()), new ManaCostsImpl("{1}{W}")); ability.addCost(new SourceHasCountersCost(4, CounterType.QUEST)); @@ -82,29 +81,30 @@ public class LuminarchAscension extends CardImpl { class LuminarchAscensionTriggeredAbility extends TriggeredAbilityImpl { - public LuminarchAscensionTriggeredAbility() { - super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.QUEST.createInstance()), true); - } - - public LuminarchAscensionTriggeredAbility(LuminarchAscensionTriggeredAbility ability) { - super(ability); - } - - @Override - public LuminarchAscensionTriggeredAbility copy() { - return new LuminarchAscensionTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE - && game.getOpponents(controllerId).contains(event.getPlayerId())) { - return true; - } - return false; - } + public LuminarchAscensionTriggeredAbility() { + super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.QUEST.createInstance()), true); } + public LuminarchAscensionTriggeredAbility(LuminarchAscensionTriggeredAbility ability) { + super(ability); + } + + @Override + public LuminarchAscensionTriggeredAbility copy() { + return new LuminarchAscensionTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.END_TURN_STEP_PRE; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return game.getOpponents(controllerId).contains(event.getPlayerId()); + } +} + class SourceHasCountersCost extends CostImpl { private final int counters; @@ -156,4 +156,3 @@ class YouLostNoLifeThisTurnCondition implements Condition { return false; } } - diff --git a/Mage.Sets/src/mage/sets/zendikar/MireBlight.java b/Mage.Sets/src/mage/sets/zendikar/MireBlight.java index c041d79262..9a6b87ebc5 100644 --- a/Mage.Sets/src/mage/sets/zendikar/MireBlight.java +++ b/Mage.Sets/src/mage/sets/zendikar/MireBlight.java @@ -28,18 +28,19 @@ package mage.sets.zendikar; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; @@ -92,15 +93,18 @@ class MireBlightTriggeredAbility extends TriggeredAbilityImpl { return new MireBlightTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) { - Permanent enchantment = game.getPermanent(sourceId); - UUID targetId = event.getTargetId(); - if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) { - this.getEffects().get(0).setTargetPointer(new FixedTarget(targetId)); - return true; - } + Permanent enchantment = game.getPermanent(sourceId); + UUID targetId = event.getTargetId(); + if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) { + this.getEffects().get(0).setTargetPointer(new FixedTarget(targetId)); + return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/zendikar/PunishingFire.java b/Mage.Sets/src/mage/sets/zendikar/PunishingFire.java index f26ed4dfbe..d2289b99f4 100644 --- a/Mage.Sets/src/mage/sets/zendikar/PunishingFire.java +++ b/Mage.Sets/src/mage/sets/zendikar/PunishingFire.java @@ -28,17 +28,18 @@ package mage.sets.zendikar; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.ReturnToHandSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCreatureOrPlayer; /** @@ -84,12 +85,14 @@ class PunishingFireTriggeredAbility extends TriggeredAbilityImpl { return new PunishingFireTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.GAINED_LIFE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.GAINED_LIFE && game.getOpponents(this.controllerId).contains(event.getPlayerId())) { - return true; - } - return false; + return game.getOpponents(this.controllerId).contains(event.getPlayerId()); } @Override diff --git a/Mage.Sets/src/mage/sets/zendikar/QuestForPureFlame.java b/Mage.Sets/src/mage/sets/zendikar/QuestForPureFlame.java index 1045a048dc..3ac853b0e9 100644 --- a/Mage.Sets/src/mage/sets/zendikar/QuestForPureFlame.java +++ b/Mage.Sets/src/mage/sets/zendikar/QuestForPureFlame.java @@ -44,6 +44,7 @@ import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; /** * @@ -89,10 +90,14 @@ class QuestForPureFlameTriggeredAbility extends TriggeredAbilityImpl { return new QuestForPureFlameTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType().equals(GameEvent.EventType.DAMAGED_PLAYER) - && game.getOpponents(getControllerId()).contains(event.getTargetId())) { + if (game.getOpponents(getControllerId()).contains(event.getTargetId())) { return getControllerId().equals(game.getControllerId(event.getSourceId())); } return false; diff --git a/Mage.Sets/src/mage/sets/zendikar/QuestForTheGemblades.java b/Mage.Sets/src/mage/sets/zendikar/QuestForTheGemblades.java index 28cf04f0e7..ad819ef5df 100644 --- a/Mage.Sets/src/mage/sets/zendikar/QuestForTheGemblades.java +++ b/Mage.Sets/src/mage/sets/zendikar/QuestForTheGemblades.java @@ -42,6 +42,7 @@ import mage.counters.CounterType; import mage.game.Game; import mage.game.events.DamagedCreatureEvent; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.target.common.TargetCreaturePermanent; @@ -92,17 +93,20 @@ class QuestForTheGembladesTriggeredAbility extends TriggeredAbilityImpl { return new QuestForTheGembladesTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_CREATURE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) { - if (((DamagedCreatureEvent) event).isCombatDamage()) { - Permanent permanent = game.getPermanent(event.getSourceId()); - if (permanent == null) { - permanent = (Permanent) game.getLastKnownInformation(event.getSourceId(), Zone.BATTLEFIELD); - } - if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && permanent.getControllerId().equals(this.getControllerId())) { - return true; - } + if (((DamagedCreatureEvent) event).isCombatDamage()) { + Permanent permanent = game.getPermanent(event.getSourceId()); + if (permanent == null) { + permanent = (Permanent) game.getLastKnownInformation(event.getSourceId(), Zone.BATTLEFIELD); + } + if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && permanent.getControllerId().equals(this.getControllerId())) { + return true; } } return false; diff --git a/Mage.Sets/src/mage/sets/zendikar/ScuteMob.java b/Mage.Sets/src/mage/sets/zendikar/ScuteMob.java index 7488dfa2e1..70ca2dd115 100644 --- a/Mage.Sets/src/mage/sets/zendikar/ScuteMob.java +++ b/Mage.Sets/src/mage/sets/zendikar/ScuteMob.java @@ -29,13 +29,13 @@ package mage.sets.zendikar; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.common.FilterLandPermanent; import mage.game.Game; @@ -86,12 +86,14 @@ class ScuteMobAbility extends TriggeredAbilityImpl { return new ScuteMobAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.UPKEEP_STEP_PRE; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) { - return true; - } - return false; + return event.getPlayerId().equals(this.controllerId); } @Override diff --git a/Mage.Sets/src/mage/sets/zendikar/ValakutTheMoltenPinnacle.java b/Mage.Sets/src/mage/sets/zendikar/ValakutTheMoltenPinnacle.java index 62172cb307..a689e53871 100644 --- a/Mage.Sets/src/mage/sets/zendikar/ValakutTheMoltenPinnacle.java +++ b/Mage.Sets/src/mage/sets/zendikar/ValakutTheMoltenPinnacle.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.zendikar; import java.util.UUID; @@ -85,7 +84,7 @@ public class ValakutTheMoltenPinnacle extends CardImpl { class ValakutTheMoltenPinnacleTriggeredAbility extends TriggeredAbilityImpl { - ValakutTheMoltenPinnacleTriggeredAbility () { + ValakutTheMoltenPinnacleTriggeredAbility() { super(Zone.BATTLEFIELD, new DamageTargetEffect(3), true); this.addTarget(new TargetCreatureOrPlayer()); } @@ -99,18 +98,22 @@ class ValakutTheMoltenPinnacleTriggeredAbility extends TriggeredAbilityImpl { return game.getBattlefield().count(ValakutTheMoltenPinnacle.filter, getSourceId(), getControllerId(), game) > 5; } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ENTERS_THE_BATTLEFIELD; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) { - Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent.getCardType().contains(CardType.LAND) && permanent.getControllerId().equals(this.getControllerId())) { - if(permanent.hasSubtype("Mountain")){ - return true; - } + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent.getCardType().contains(CardType.LAND) && permanent.getControllerId().equals(this.getControllerId())) { + if (permanent.hasSubtype("Mountain")) { + return true; } } return false; } + @Override public ValakutTheMoltenPinnacleTriggeredAbility copy() { return new ValakutTheMoltenPinnacleTriggeredAbility(this); diff --git a/Mage.Sets/src/mage/sets/zendikar/WarrenInstigator.java b/Mage.Sets/src/mage/sets/zendikar/WarrenInstigator.java index ef559cc706..8179345ad2 100644 --- a/Mage.Sets/src/mage/sets/zendikar/WarrenInstigator.java +++ b/Mage.Sets/src/mage/sets/zendikar/WarrenInstigator.java @@ -28,10 +28,6 @@ package mage.sets.zendikar; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; @@ -39,10 +35,15 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.DoubleStrikeAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; import mage.players.Player; import mage.target.common.TargetCardInHand; @@ -90,13 +91,15 @@ class WarrenInstigatorTriggeredAbility extends TriggeredAbilityImpl { return new WarrenInstigatorTriggeredAbility(this); } + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DAMAGED_PLAYER; + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId) - && game.getOpponents(this.getControllerId()).contains(event.getTargetId())) { - return true; - } - return false; + return event.getSourceId().equals(this.sourceId) + && game.getOpponents(this.getControllerId()).contains(event.getTargetId()); } @Override diff --git a/Mage/src/mage/abilities/TriggeredAbilityImpl.java b/Mage/src/mage/abilities/TriggeredAbilityImpl.java index d38ae09362..c07195414b 100644 --- a/Mage/src/mage/abilities/TriggeredAbilityImpl.java +++ b/Mage/src/mage/abilities/TriggeredAbilityImpl.java @@ -79,10 +79,10 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge } // TODO: Implement for all TriggeredAbilities so this default method can be removed - @Override + /*@Override public boolean checkEventType(GameEvent event, Game game) { return true; - } + }*/ @Override public boolean resolve(Game game) {