mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 09:48:02 +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.
|
* 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. */
|
/** The host card. */
|
||||||
protected Card hostCard;
|
protected Card hostCard;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ import forge.game.staticability.StaticAbilityCantAttach;
|
|||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.util.Lang;
|
import forge.util.Lang;
|
||||||
|
|
||||||
public abstract class GameEntity extends GameObject implements IIdentifiable {
|
public abstract class GameEntity implements GameObject, IIdentifiable {
|
||||||
protected int id;
|
protected int id;
|
||||||
private String name = "";
|
private String name = "";
|
||||||
protected CardCollection attachedCards = new CardCollection();
|
protected CardCollection attachedCards = new CardCollection();
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import forge.game.card.Card;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.spellability.SpellAbility;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ public abstract class GameObject {
|
|||||||
* @param spellAbility
|
* @param spellAbility
|
||||||
* @return true, if is valid
|
* @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) {
|
for (final String restriction : restrictions) {
|
||||||
if (this.isValid(restriction, sourceController, source, spellAbility)) {
|
if (this.isValid(restriction, sourceController, source, spellAbility)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -43,7 +43,7 @@ public abstract class GameObject {
|
|||||||
* @param spellAbility
|
* @param spellAbility
|
||||||
* @return true, if is valid
|
* @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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ public abstract class GameObject {
|
|||||||
* @param spellAbility
|
* @param spellAbility
|
||||||
* @return true, if successful
|
* @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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ import java.util.Set;
|
|||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class CardState extends GameObject implements IHasSVars, ITranslatable {
|
public class CardState implements GameObject, IHasSVars, ITranslatable {
|
||||||
private String name = "";
|
private String name = "";
|
||||||
private CardType type = new CardType(false);
|
private CardType type = new CardType(false);
|
||||||
private ManaCost manaCost = ManaCost.NO_COST;
|
private ManaCost manaCost = ManaCost.NO_COST;
|
||||||
|
|||||||
Reference in New Issue
Block a user