split dialogs and war/campaign/round classes to files
This commit is contained in:
parent
55abdccc64
commit
019e62565f
22 changed files with 562 additions and 502 deletions
35
src/warchron/model/battle.py
Normal file
35
src/warchron/model/battle.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
class Battle:
|
||||
def __init__(
|
||||
self,
|
||||
sector_id: str,
|
||||
player_1_id: str | None = None,
|
||||
player_2_id: str | None = None,
|
||||
):
|
||||
self.sector_id: str = sector_id # ref to Campaign.sector
|
||||
self.player_1_id: str | None = player_1_id # ref to Campaign.participants
|
||||
self.player_2_id: str | None = player_2_id # ref to Campaign.participants
|
||||
self.winner_id: str | None = None
|
||||
self.score: str | None = None
|
||||
self.victory_condition: str | None = None
|
||||
self.comment: str | None = None
|
||||
|
||||
def set_id(self, new_id: str) -> None:
|
||||
self.sector_id = new_id
|
||||
|
||||
def set_player_1(self, new_player_id: str | None) -> None:
|
||||
self.player_1_id = new_player_id
|
||||
|
||||
def set_player_2(self, new_player_id: str | None) -> None:
|
||||
self.player_2_id = new_player_id
|
||||
|
||||
def set_winner(self, new_player_id: str | None) -> None:
|
||||
self.winner_id = new_player_id
|
||||
|
||||
def set_score(self, new_score: str | None) -> None:
|
||||
self.score = new_score
|
||||
|
||||
def set_victory_condition(self, new_victory_condition: str | None) -> None:
|
||||
self.victory_condition = new_victory_condition
|
||||
|
||||
def set_comment(self, new_comment: str | None) -> None:
|
||||
self.comment = new_comment
|
||||
|
|
@ -2,7 +2,11 @@ from __future__ import annotations
|
|||
from uuid import uuid4
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from warchron.model.round import Round, Choice, Battle
|
||||
from warchron.model.campaign_participant import CampaignParticipant
|
||||
from warchron.model.sector import Sector
|
||||
from warchron.model.round import Round
|
||||
from warchron.model.choice import Choice
|
||||
from warchron.model.battle import Battle
|
||||
|
||||
|
||||
class Campaign:
|
||||
|
|
@ -227,62 +231,3 @@ class Campaign:
|
|||
def remove_battle(self, round_id: str, sector_id: str) -> None:
|
||||
rnd = self.get_round(round_id)
|
||||
rnd.remove_battle(sector_id)
|
||||
|
||||
|
||||
class CampaignParticipant:
|
||||
def __init__(
|
||||
self, *, war_participant_id: str, leader: str | None, theme: str | None
|
||||
):
|
||||
self.id: str = str(uuid4())
|
||||
self.war_participant_id: str = war_participant_id # ref to War.participants
|
||||
self.leader: str | None = leader
|
||||
self.theme: str | None = theme
|
||||
|
||||
def set_id(self, new_id: str) -> None:
|
||||
self.id = new_id
|
||||
|
||||
def set_war_participant(self, new_participant: str) -> None:
|
||||
self.war_participant_id = new_participant
|
||||
|
||||
def set_leader(self, new_faction: str) -> None:
|
||||
self.leader = new_faction
|
||||
|
||||
def set_theme(self, new_theme: str) -> None:
|
||||
self.theme = new_theme
|
||||
|
||||
|
||||
class Sector:
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
round_id: str,
|
||||
major_id: str | None,
|
||||
minor_id: str | None,
|
||||
influence_id: str | None,
|
||||
):
|
||||
self.id: str = str(uuid4())
|
||||
self.name: str = name
|
||||
self.round_id: str = round_id
|
||||
self.major_objective_id: str | None = major_id # ref to War.objectives
|
||||
self.minor_objective_id: str | None = minor_id # ref to War.objectives
|
||||
self.influence_objective_id: str | None = influence_id # ref to War.objectives
|
||||
self.mission: str | None = None
|
||||
self.description: str | None = None
|
||||
|
||||
def set_id(self, new_id: str) -> None:
|
||||
self.id = new_id
|
||||
|
||||
def set_name(self, new_name: str) -> None:
|
||||
self.name = new_name
|
||||
|
||||
def set_round(self, new_round_id: str) -> None:
|
||||
self.round_id = new_round_id
|
||||
|
||||
def set_major(self, new_major_id: str) -> None:
|
||||
self.major_objective_id = new_major_id
|
||||
|
||||
def set_minor(self, new_minor_id: str) -> None:
|
||||
self.minor_objective_id = new_minor_id
|
||||
|
||||
def set_influence(self, new_influence_id: str) -> None:
|
||||
self.influence_objective_id = new_influence_id
|
||||
|
|
|
|||
24
src/warchron/model/campaign_participant.py
Normal file
24
src/warchron/model/campaign_participant.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
from __future__ import annotations
|
||||
from uuid import uuid4
|
||||
|
||||
|
||||
class CampaignParticipant:
|
||||
def __init__(
|
||||
self, *, war_participant_id: str, leader: str | None, theme: str | None
|
||||
):
|
||||
self.id: str = str(uuid4())
|
||||
self.war_participant_id: str = war_participant_id # ref to War.participants
|
||||
self.leader: str | None = leader
|
||||
self.theme: str | None = theme
|
||||
|
||||
def set_id(self, new_id: str) -> None:
|
||||
self.id = new_id
|
||||
|
||||
def set_war_participant(self, new_participant: str) -> None:
|
||||
self.war_participant_id = new_participant
|
||||
|
||||
def set_leader(self, new_faction: str) -> None:
|
||||
self.leader = new_faction
|
||||
|
||||
def set_theme(self, new_theme: str) -> None:
|
||||
self.theme = new_theme
|
||||
27
src/warchron/model/choice.py
Normal file
27
src/warchron/model/choice.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
class Choice:
|
||||
def __init__(
|
||||
self,
|
||||
participant_id: str,
|
||||
priority_sector_id: str | None = None,
|
||||
secondary_sector_id: str | None = None,
|
||||
):
|
||||
self.participant_id: str = participant_id # ref to Campaign.participants
|
||||
self.priority_sector_id: str | None = (
|
||||
priority_sector_id # ref to Campaign.sectors
|
||||
)
|
||||
self.secondary_sector_id: str | None = (
|
||||
secondary_sector_id # ref to Campaign.sectors
|
||||
)
|
||||
self.comment: str | None = None
|
||||
|
||||
def set_id(self, new_id: str) -> None:
|
||||
self.participant_id = new_id
|
||||
|
||||
def set_priority(self, new_priority_id: str | None) -> None:
|
||||
self.priority_sector_id = new_priority_id
|
||||
|
||||
def set_secondary(self, new_secondary_id: str | None) -> None:
|
||||
self.secondary_sector_id = new_secondary_id
|
||||
|
||||
def set_comment(self, new_comment: str | None) -> None:
|
||||
self.comment = new_comment
|
||||
|
|
@ -5,9 +5,15 @@ import shutil
|
|||
from datetime import datetime
|
||||
|
||||
from warchron.model.player import Player
|
||||
from warchron.model.war import War, Objective, WarParticipant
|
||||
from warchron.model.campaign import Campaign, Sector, CampaignParticipant
|
||||
from warchron.model.round import Round, Choice, Battle
|
||||
from warchron.model.war import War
|
||||
from warchron.model.war_participant import WarParticipant
|
||||
from warchron.model.objective import Objective
|
||||
from warchron.model.campaign import Campaign
|
||||
from warchron.model.campaign_participant import CampaignParticipant
|
||||
from warchron.model.sector import Sector
|
||||
from warchron.model.round import Round
|
||||
from warchron.model.choice import Choice
|
||||
from warchron.model.battle import Battle
|
||||
|
||||
|
||||
class Model:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
from __future__ import annotations
|
||||
from uuid import uuid4
|
||||
|
||||
|
||||
class Objective:
|
||||
def __init__(self, name: str, description: str):
|
||||
self.id: str = str(uuid4())
|
||||
self.name: str = name
|
||||
self.description: str = description
|
||||
|
||||
def set_id(self, new_id: str) -> None:
|
||||
self.id = new_id
|
||||
|
||||
def set_name(self, new_name: str) -> None:
|
||||
self.name = new_name
|
||||
|
||||
def set_description(self, new_description: str) -> None:
|
||||
self.description = new_description
|
||||
|
|
@ -2,6 +2,9 @@ from __future__ import annotations
|
|||
from uuid import uuid4
|
||||
from typing import Any, Dict
|
||||
|
||||
from warchron.model.choice import Choice
|
||||
from warchron.model.battle import Battle
|
||||
|
||||
|
||||
class Round:
|
||||
def __init__(self) -> None:
|
||||
|
|
@ -98,69 +101,3 @@ class Round:
|
|||
|
||||
def remove_battle(self, sector_id: str) -> None:
|
||||
del self.battles[sector_id]
|
||||
|
||||
|
||||
class Choice:
|
||||
def __init__(
|
||||
self,
|
||||
participant_id: str,
|
||||
priority_sector_id: str | None = None,
|
||||
secondary_sector_id: str | None = None,
|
||||
):
|
||||
self.participant_id: str = participant_id # ref to Campaign.participants
|
||||
self.priority_sector_id: str | None = (
|
||||
priority_sector_id # ref to Campaign.sectors
|
||||
)
|
||||
self.secondary_sector_id: str | None = (
|
||||
secondary_sector_id # ref to Campaign.sectors
|
||||
)
|
||||
self.comment: str | None = None
|
||||
|
||||
def set_id(self, new_id: str) -> None:
|
||||
self.participant_id = new_id
|
||||
|
||||
def set_priority(self, new_priority_id: str | None) -> None:
|
||||
self.priority_sector_id = new_priority_id
|
||||
|
||||
def set_secondary(self, new_secondary_id: str | None) -> None:
|
||||
self.secondary_sector_id = new_secondary_id
|
||||
|
||||
def set_comment(self, new_comment: str | None) -> None:
|
||||
self.comment = new_comment
|
||||
|
||||
|
||||
class Battle:
|
||||
def __init__(
|
||||
self,
|
||||
sector_id: str,
|
||||
player_1_id: str | None = None,
|
||||
player_2_id: str | None = None,
|
||||
):
|
||||
self.sector_id: str = sector_id # ref to Campaign.sector
|
||||
self.player_1_id: str | None = player_1_id # ref to Campaign.participants
|
||||
self.player_2_id: str | None = player_2_id # ref to Campaign.participants
|
||||
self.winner_id: str | None = None
|
||||
self.score: str | None = None
|
||||
self.victory_condition: str | None = None
|
||||
self.comment: str | None = None
|
||||
|
||||
def set_id(self, new_id: str) -> None:
|
||||
self.sector_id = new_id
|
||||
|
||||
def set_player_1(self, new_player_id: str | None) -> None:
|
||||
self.player_1_id = new_player_id
|
||||
|
||||
def set_player_2(self, new_player_id: str | None) -> None:
|
||||
self.player_2_id = new_player_id
|
||||
|
||||
def set_winner(self, new_player_id: str | None) -> None:
|
||||
self.winner_id = new_player_id
|
||||
|
||||
def set_score(self, new_score: str | None) -> None:
|
||||
self.score = new_score
|
||||
|
||||
def set_victory_condition(self, new_victory_condition: str | None) -> None:
|
||||
self.victory_condition = new_victory_condition
|
||||
|
||||
def set_comment(self, new_comment: str | None) -> None:
|
||||
self.comment = new_comment
|
||||
|
|
|
|||
39
src/warchron/model/sector.py
Normal file
39
src/warchron/model/sector.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
from __future__ import annotations
|
||||
from uuid import uuid4
|
||||
|
||||
|
||||
class Sector:
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
round_id: str,
|
||||
major_id: str | None,
|
||||
minor_id: str | None,
|
||||
influence_id: str | None,
|
||||
):
|
||||
self.id: str = str(uuid4())
|
||||
self.name: str = name
|
||||
self.round_id: str = round_id
|
||||
self.major_objective_id: str | None = major_id # ref to War.objectives
|
||||
self.minor_objective_id: str | None = minor_id # ref to War.objectives
|
||||
self.influence_objective_id: str | None = influence_id # ref to War.objectives
|
||||
self.mission: str | None = None
|
||||
self.description: str | None = None
|
||||
|
||||
def set_id(self, new_id: str) -> None:
|
||||
self.id = new_id
|
||||
|
||||
def set_name(self, new_name: str) -> None:
|
||||
self.name = new_name
|
||||
|
||||
def set_round(self, new_round_id: str) -> None:
|
||||
self.round_id = new_round_id
|
||||
|
||||
def set_major(self, new_major_id: str) -> None:
|
||||
self.major_objective_id = new_major_id
|
||||
|
||||
def set_minor(self, new_minor_id: str) -> None:
|
||||
self.minor_objective_id = new_minor_id
|
||||
|
||||
def set_influence(self, new_influence_id: str) -> None:
|
||||
self.influence_objective_id = new_influence_id
|
||||
|
|
@ -3,8 +3,14 @@ from uuid import uuid4
|
|||
from datetime import datetime
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from warchron.model.campaign import Campaign, Sector, CampaignParticipant
|
||||
from warchron.model.round import Round, Choice, Battle
|
||||
from warchron.model.war_participant import WarParticipant
|
||||
from warchron.model.objective import Objective
|
||||
from warchron.model.campaign_participant import CampaignParticipant
|
||||
from warchron.model.sector import Sector
|
||||
from warchron.model.campaign import Campaign
|
||||
from warchron.model.round import Round
|
||||
from warchron.model.choice import Choice
|
||||
from warchron.model.battle import Battle
|
||||
|
||||
|
||||
class War:
|
||||
|
|
@ -312,35 +318,3 @@ class War:
|
|||
def remove_battle(self, round_id: str, sector_id: str) -> None:
|
||||
camp = self.get_campaign_by_round(round_id)
|
||||
camp.remove_battle(round_id, sector_id)
|
||||
|
||||
|
||||
class Objective:
|
||||
def __init__(self, name: str, description: str):
|
||||
self.id: str = str(uuid4())
|
||||
self.name: str = name
|
||||
self.description: str = description
|
||||
|
||||
def set_id(self, new_id: str) -> None:
|
||||
self.id = new_id
|
||||
|
||||
def set_name(self, new_name: str) -> None:
|
||||
self.name = new_name
|
||||
|
||||
def set_description(self, new_description: str) -> None:
|
||||
self.description = new_description
|
||||
|
||||
|
||||
class WarParticipant:
|
||||
def __init__(self, *, player_id: str, faction: str):
|
||||
self.id: str = str(uuid4())
|
||||
self.player_id: str = player_id # ref to WarModel.players
|
||||
self.faction: str = faction
|
||||
|
||||
def set_id(self, new_id: str) -> None:
|
||||
self.id = new_id
|
||||
|
||||
def set_player(self, new_player: str) -> None:
|
||||
self.player_id = new_player
|
||||
|
||||
def set_faction(self, new_faction: str) -> None:
|
||||
self.faction = new_faction
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
from __future__ import annotations
|
||||
from uuid import uuid4
|
||||
|
||||
|
||||
class WarParticipant:
|
||||
def __init__(self, *, player_id: str, faction: str):
|
||||
self.id: str = str(uuid4())
|
||||
self.player_id: str = player_id # ref to WarModel.players
|
||||
self.faction: str = faction
|
||||
|
||||
def set_id(self, new_id: str) -> None:
|
||||
self.id = new_id
|
||||
|
||||
def set_player(self, new_player: str) -> None:
|
||||
self.player_id = new_player
|
||||
|
||||
def set_faction(self, new_faction: str) -> None:
|
||||
self.faction = new_faction
|
||||
Loading…
Add table
Add a link
Reference in a new issue