Skip to content

gdformat is adding unnecessary () bracket on this specific if and code #409

@pegasusearl

Description

@pegasusearl

It doesn't usually do this but here it is:

See the Phase.THROW_TILE_CARDS section.

Before

func _phase_step() -> void:
	match current_phase:
		Phase.WAITING_PLAYER_DECK:
			if (
				players[Pl.EVEN].anima != Anima.Db.NONE
				and players[Pl.ODD].anima != Anima.Db.NONE
				and players[Pl.EVEN].spell_deck.size() == Domino.SPELL_CARD_REQUIRED
				and players[Pl.ODD].spell_deck.size() == Domino.SPELL_CARD_REQUIRED
			):
				next_phase = Phase.THROW_TILE_CARDS
		Phase.THROW_TILE_CARDS:
			if (
				players[Pl.EVEN].tile_set_selected.count() == Domino.TILE_CARDS_PER_MATCH_PER_PLAYER
				and	players[Pl.ODD].tile_set_selected.count() == Domino.TILE_CARDS_PER_MATCH_PER_PLAYER
			):
				next_phase = Phase.MAIN
	# Phase transition
	if current_phase != next_phase:
		_transition_phase(current_phase, next_phase)
		current_phase = next_phase
		_phase_step()  # Call step again in the same tick/frame after phase change, because why not?

After

func _phase_step() -> void:
	match current_phase:
		Phase.WAITING_PLAYER_DECK:
			if (
				players[Pl.EVEN].anima != Anima.Db.NONE
				and players[Pl.ODD].anima != Anima.Db.NONE
				and players[Pl.EVEN].spell_deck.size() == Domino.SPELL_CARD_REQUIRED
				and players[Pl.ODD].spell_deck.size() == Domino.SPELL_CARD_REQUIRED
			):
				next_phase = Phase.THROW_TILE_CARDS
		Phase.THROW_TILE_CARDS:
			if (
				players[Pl.EVEN].tile_set_selected.count() == Domino.TILE_CARDS_PER_MATCH_PER_PLAYER
				and (
					players[Pl.ODD].tile_set_selected.count()
					== Domino.TILE_CARDS_PER_MATCH_PER_PLAYER
				)
			):
				next_phase = Phase.MAIN
	# Phase transition
	if current_phase != next_phase:
		_transition_phase(current_phase, next_phase)
		current_phase = next_phase
		_phase_step()  # Call step again in the same tick/frame after phase change, because why not?

I already ran pip3 install "gdtoolkit==4.*" before testing. Not sure if it's the correct way to update gdformat.

sample code sample.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions