Merge pull request #5699 from ketsuban/unhinged

Implement Elvish House Party
This commit is contained in:
Oleg Agafonov 2019-04-09 08:18:08 +02:00 committed by GitHub
commit cb7f42ea06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 74 additions and 0 deletions

View file

@ -0,0 +1,73 @@
package mage.cards.e;
import java.time.LocalTime;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
/**
*
* @author Ketsuban
*/
public final class ElvishHouseParty extends CardImpl {
public ElvishHouseParty(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[] { CardType.CREATURE }, "{4}{G}{G}");
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.ROGUE);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Elvish House Party's power and toughness are each equal to the current hour,
// using the twelve-hour system.
this.addAbility(new SimpleStaticAbility(Zone.ALL,
new SetPowerToughnessSourceEffect(new CurrentHourCount(), Duration.WhileOnBattlefield)));
}
public ElvishHouseParty(final ElvishHouseParty card) {
super(card);
}
@Override
public ElvishHouseParty copy() {
return new ElvishHouseParty(this);
}
}
class CurrentHourCount implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
int hour = LocalTime.now().getHour();
// convert 24-hour value to 12-hour
if (hour > 12) {
hour -= 12;
}
if (hour == 0) {
hour = 12;
}
return hour;
}
@Override
public DynamicValue copy() {
return new CurrentHourCount();
}
@Override
public String getMessage() {
return "current hour, using the twelve-hour system";
}
}

View file

@ -27,6 +27,7 @@ public final class Unhinged extends ExpansionSet {
cards.add(new SetCardInfo("Bloodletter", 50, Rarity.COMMON, mage.cards.b.Bloodletter.class)); cards.add(new SetCardInfo("Bloodletter", 50, Rarity.COMMON, mage.cards.b.Bloodletter.class));
cards.add(new SetCardInfo("Booster Tutor", 51, Rarity.UNCOMMON, mage.cards.b.BoosterTutor.class)); cards.add(new SetCardInfo("Booster Tutor", 51, Rarity.UNCOMMON, mage.cards.b.BoosterTutor.class));
cards.add(new SetCardInfo("Double Header", 31, Rarity.COMMON, mage.cards.d.DoubleHeader.class)); cards.add(new SetCardInfo("Double Header", 31, Rarity.COMMON, mage.cards.d.DoubleHeader.class));
cards.add(new SetCardInfo("Elvish House Party", 94, Rarity.UNCOMMON, mage.cards.e.ElvishHouseParty.class));
cards.add(new SetCardInfo("First Come, First Served", 12, Rarity.UNCOMMON, mage.cards.f.FirstComeFirstServed.class)); cards.add(new SetCardInfo("First Come, First Served", 12, Rarity.UNCOMMON, mage.cards.f.FirstComeFirstServed.class));
cards.add(new SetCardInfo("Forest", 140, Rarity.LAND, mage.cards.basiclands.Forest.class, new CardGraphicInfo(FrameStyle.UNH_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Forest", 140, Rarity.LAND, mage.cards.basiclands.Forest.class, new CardGraphicInfo(FrameStyle.UNH_FULL_ART_BASIC, false)));
cards.add(new SetCardInfo("Form of the Squirrel", 96, Rarity.RARE, mage.cards.f.FormOfTheSquirrel.class)); cards.add(new SetCardInfo("Form of the Squirrel", 96, Rarity.RARE, mage.cards.f.FormOfTheSquirrel.class));