mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-11 16:26:22 +00:00
GameObject: turn into an interface
This commit is contained in:
@@ -36,7 +36,7 @@ import forge.util.ITranslatable;
|
||||
* Base class for Triggers,ReplacementEffects and StaticAbilities.
|
||||
*
|
||||
*/
|
||||
public abstract class CardTraitBase extends GameObject implements IHasCardView, IHasSVars {
|
||||
public abstract class CardTraitBase implements GameObject, IHasCardView, IHasSVars {
|
||||
|
||||
/** The host card. */
|
||||
protected Card hostCard;
|
||||
|
||||
@@ -46,7 +46,7 @@ import forge.game.staticability.StaticAbilityCantAttach;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.util.Lang;
|
||||
|
||||
public abstract class GameEntity extends GameObject implements IIdentifiable {
|
||||
public abstract class GameEntity implements GameObject, IIdentifiable {
|
||||
protected int id;
|
||||
private String name = "";
|
||||
protected CardCollection attachedCards = new CardCollection();
|
||||
|
||||
@@ -4,9 +4,9 @@ import forge.game.card.Card;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
|
||||
public abstract class GameObject {
|
||||
public interface GameObject {
|
||||
|
||||
public boolean canBeTargetedBy(final SpellAbility sa) {
|
||||
public default boolean canBeTargetedBy(final SpellAbility sa) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public abstract class GameObject {
|
||||
* @param spellAbility
|
||||
* @return true, if is valid
|
||||
*/
|
||||
public boolean isValid(final String[] restrictions, final Player sourceController, final Card source, CardTraitBase spellAbility) {
|
||||
public default boolean isValid(final String[] restrictions, final Player sourceController, final Card source, CardTraitBase spellAbility) {
|
||||
for (final String restriction : restrictions) {
|
||||
if (this.isValid(restriction, sourceController, source, spellAbility)) {
|
||||
return true;
|
||||
@@ -43,7 +43,7 @@ public abstract class GameObject {
|
||||
* @param spellAbility
|
||||
* @return true, if is valid
|
||||
*/
|
||||
public boolean isValid(final String restriction, final Player sourceController, final Card source, CardTraitBase spellAbility) {
|
||||
public default boolean isValid(final String restriction, final Player sourceController, final Card source, CardTraitBase spellAbility) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public abstract class GameObject {
|
||||
* @param spellAbility
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean hasProperty(final String property, final Player sourceController, final Card source, CardTraitBase spellAbility) {
|
||||
public default boolean hasProperty(final String property, final Player sourceController, final Card source, CardTraitBase spellAbility) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CardState extends GameObject implements IHasSVars, ITranslatable {
|
||||
public class CardState implements GameObject, IHasSVars, ITranslatable {
|
||||
private String name = "";
|
||||
private CardType type = new CardType(false);
|
||||
private ManaCost manaCost = ManaCost.NO_COST;
|
||||
|
||||
Reference in New Issue
Block a user