def perform(self, char: Character, state: State): toAlly = state.getChar(self.charShort) if char.isAlone() and toAlly.isAlone(): alliance = [] char.joinAlliance(alliance) toAlly.joinAlliance(alliance) return f"allied with: {toAlly}" elif not char.isAlone(): alliance = char.getAlliance() toAlly.leaveAlliance() toAlly.joinAlliance(alliance) return f"alliance joined by: {toAlly}" elif not toAlly.isAlone(): alliance = toAlly.getAlliance() char.leaveAlliance() char.joinAlliance(alliance) return f"joined alliance of: {toAlly}"
def perform(self, char: Character, state: State): char.leaveAlliance() return "left alliance"