Summary of REQ_TARGET_IF_AVAILABLE and REQ_TARGET_TO_PLAY - aharalabMeiji/fireplaceAharaLab GitHub Wiki

summary

PlayReq.REQ_TARGET_IF_AVAILABLE: if there are (at least one) cards to be targeted, the player must choose one from the targets; otherwise, no need to choose a targeted card.

PlayReq.REQ_TARGET_TO_PLAY: Player must choose a target, and if there is no target, he/she cannot play the card.

attributes and methods

card.targets (in card.py)

@property
def targets(self):
	if self.zone == Zone.PLAY:
		return self.attack_targets
	return super().targets

card.requires_targets ( in card.py)

	if PlayReq.REQ_TARGET_IF_AVAILABLE in self.requirements:
		return bool(self.play_targets)

card.is_playable ( in card.py)

	if PlayReq.REQ_TARGET_TO_PLAY in self.requirements:
		if not self.play_targets:
			return False