Skip to content

Commit

Permalink
Merge branch 'main' of github.com:flick-ai/Genius-Invokation
Browse files Browse the repository at this point in the history
  • Loading branch information
WentDong committed Aug 16, 2024
2 parents d9e4768 + f077751 commit 1da1437
Show file tree
Hide file tree
Showing 59 changed files with 1,574 additions and 47 deletions.
3 changes: 3 additions & 0 deletions genius_invocation/card/action/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class ActionCard:
card_type: ActionCardType
can_tune: bool = True

def __init__(self) -> None:
self.zone = None

def calculate_dice(self) -> int:
if self.cost_type == ActionCardType.EQUIPMENT_TALENT:
count = sum([i['cost_num'] for i in self.cost])
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from genius_invocation.utils import *
from genius_invocation.card.action.equipment.artifact.base import ArtifactCard
from genius_invocation.entity.status import Artifact
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from genius_invocation.game.game import GeniusGame
from genius_invocation.game.player import GeniusPlayer


class GladiatorsTriumphusEntity(Artifact):
id = 31202991
name: str = "Gladiator's Triumphus"
name_ch = "角斗士的凯旋"
max_usage = 1
def __init__(self, game: 'GeniusGame', from_player: 'GeniusPlayer', from_character = None, artifact_card = None):
super().__init__(game, from_player, from_character, artifact_card)
self.round_usage = 1

def on_calculate(self, game: 'GeniusGame'):
if self.round_usage > 0:
if game.active_player_index == self.from_player.index:
if game.current_dice.from_character == self.from_character:
if game.current_dice.use_type == SkillType.NORMAL_ATTACK:
if game.current_dice.cost[1]['cost_num'] > 0:
game.current_dice.cost[1]['cost_num'] -= 1
return True
return False

def on_skill(self, game: 'GeniusGame'):
if self.on_calculate(game):
self.round_usage = 0

def on_end(self, game: 'GeniusGame'):
self.round_usage = 1

def update_listener_list(self):
self.listeners = [
(EventType.ON_USE_SKILL, ZoneType.CHARACTER_ZONE, self.on_skill),
(EventType.CALCULATE_DICE, ZoneType.CHARACTER_ZONE, self.on_calculate),
(EventType.FINAL_END, ZoneType.CHARACTER_ZONE, self.on_end)
]



class GladiatorsTriumphus(ArtifactCard):
id: int = 312029
name: str = "Gladiator's Triumphus"
name_ch = "角斗士的凯旋"
time = 4.8
cost_num: int = 0
cost_type: CostType = None

def __init__(self) -> None:
super().__init__()
self.artifact_entity = GladiatorsTriumphusEntity

def on_played(self, game: 'GeniusGame') -> None:
super().on_played(game)

7 changes: 4 additions & 3 deletions genius_invocation/card/action/equipment/talent/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self) -> None:
super().__init__()
for i in range(len(self.cost)):
self.cost[i]['cost_type'] = CostType(self.cost[i]['cost_type'])

def on_played(self, game: 'GeniusGame') -> None:
target_character = game.active_player.character_list[game.current_action.target_idx]
target_character.equip_talent(game, self.is_action, self)
Expand All @@ -31,13 +31,14 @@ def find_target(self, game: 'GeniusGame'):
if not self.is_action:
for idx, character in enumerate(game.active_player.character_list):
if isinstance(character, self.character):
return [idx+2]
if character.is_alive:
return [idx+2]
else:
if isinstance(get_my_active_character(game), self.character):
if get_my_active_character(game).power >= self.cost_power:
return [game.active_player.active_idx+2]
return []

def count_cost(self):
if self.is_equip:
return sum([cost['cost_num'] for cost in self.cost])
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from genius_invocation.card.action.equipment.talent.import_head import *
from genius_invocation.card.character.characters.Navia import *

class RimeflowRapier(TalentCard):
id: int = 221041
name: str = "Rimeflow Rapier"
name_ch = "冰雅刺剑"
time = 4.8
is_action = True
cost = [{'cost_num': 3, 'cost_type': CostType.GEO.value}]
cost_power = 0
character = Navia
def __init__(self) -> None:
super().__init__()
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from genius_invocation.card.action.equipment.talent.import_head import *
from genius_invocation.card.character.characters.FrostOperative import *

class UndisclosedDistributionChannels(TalentCard):
id: int = 216081
name: str = "Undisclosed Distribution Channels"
name_ch = "不明流通渠道"
time = 4.8
is_action = True
cost = [{'cost_num': 3, 'cost_type': CostType.CRYO.value}]
cost_power = 0
character = FrostOperative
def __init__(self) -> None:
super().__init__()
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from genius_invocation.card.action.equipment.talent.import_head import *
from genius_invocation.card.character.characters.Chevreuse import *

class VanguardsCoordinatedTactics(TalentCard):
id: int = 213131
name: str = "Vanguard's Coordinated Tactics"
name_ch = "尖兵协同战法"
time = 4.8
is_action = False
cost = [{'cost_num': 2, 'cost_type': CostType.PYRO.value}]
cost_power = 0
character = Chevreuse
def __init__(self) -> None:
super().__init__()

def find_target(self, game: 'GeniusGame'):
for idx, character in enumerate(game.active_player.character_list):
if isinstance(character, self.character):
if character.is_alive:
unique_element_set = character.from_player.element_set
if len(unique_element_set) == 2 and ElementType.PYRO in unique_element_set and ElementType.ELECTRO in unique_element_set:
return [idx+2]
return []
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from genius_invocation.utils import *
from genius_invocation.card.action.equipment.weapon.base import WeaponCard
from typing import TYPE_CHECKING
from genius_invocation.entity.status import Weapon

if TYPE_CHECKING:
from genius_invocation.game.game import GeniusGame


class MagicSwordWeapon(Weapon):
id: int = 31130881
name: str = "Ultimate Overlord's Mega Magic Sword"
name_ch = "「究极霸王超级魔剑」"
def __init__(self, game: 'GeniusGame', from_player: 'GeniusPlayer', from_character = None, weapon_card = None):
super().__init__(game, from_player, from_character, weapon_card)
self.support = 0
for card_name in from_player.played_cards:
if card_name not in self.from_player.card_zone.card_name:
self.support += 1

def on_add_damage(self, game:'GeniusGame'):
if game.current_damage.damage_from == self.from_character:
if self.support >= 8:
game.current_damage.damage += 3
elif self.support >= 4:
game.current_damage.damage += 2
elif self.support >= 2:
game.current_damage.damage += 1

def on_play_card(self, game:'GeniusGame'):
if game.active_player_index == self.from_player.index:
if game.current_card.name not in self.from_player.card_zone.card_name:
self.support += 1

def update_listener_list(self):
self.listeners = [
(EventType.DAMAGE_ADD, ZoneType.CHARACTER_ZONE, self.on_add_damage),
(EventType.AFTER_PLAY_CARD, ZoneType.CHARACTER_ZONE, self.on_play_card),
]


class MagicSword(WeaponCard):
id: int = 311308
name: str = "Ultimate Overlord's Mega Magic Sword"
name_ch = "「究极霸王超级魔剑」"
time = 4.8
weapon_type: WeaponType = WeaponType.CLAYMORE
cost_num: int = 2
cost_type: CostType = CostType.WHITE

def __init__(self) -> None:
super().__init__()
self.equipment_entity = MagicSwordWeapon

def on_played(self, game: 'GeniusGame') -> None:
super().on_played(game)
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
from genius_invocation.utils import *
from genius_invocation.card.action.equipment.weapon.base import WeaponCard
from typing import TYPE_CHECKING
from genius_invocation.entity.status import Weapon

if TYPE_CHECKING:
from genius_invocation.game.game import GeniusGame


class ProspectorsDrillWeapon(Weapon):
id: int = 31140981
name: str = "Prospector's Drill"
name_ch = "勘探钻机"
def __init__(self, game: 'GeniusGame', from_player: 'GeniusPlayer', from_character = None, weapon_card = None):
super().__init__(game, from_player, from_character, weapon_card)
self.round_usage = 2
self.solidarity = 0
self.add_damage = False

def on_damage_execute(self, game: 'GeniusGame'):
if self.round_usage <=0 :
return
if game.current_damage.damage_to == self.from_character:
if game.current_damage.main_damage_element == ElementType.PIERCING:
return
if game.current_damage.main_damage > 0:
max_id = max_count_card()
if max_id == None:
return
else:
game.current_damage.main_damage -= 1
self.round_usage -= 1

def on_add_damage(self, game:'GeniusGame'):
if self.add_damage:
game.current_damage.main_damage += 1
self.add_damage = False

def after_use_skill(self, game: 'GeniusGame'):
if self.add_damage:
self.add_damage = False

def on_use_skill(self, game: 'GeniusGame'):
if game.current_skill.from_character == self.from_character:
if self.solidarity > 0:
self.add_damage = True
self.from_player.get_card(num=self.solidarity)
self.solidarity = 0

def update_listener_list(self):
self.listeners = [
(EventType.FINAL_EXECUTE, ZoneType.CHARACTER_ZONE, self.on_damage_execute),
(EventType.DAMAGE_ADD, ZoneType.CHARACTER_ZONE, self.on_add_damage),
(EventType.AFTER_USE_SKILL, ZoneType.CHARACTER_ZONE, self.after_use_skill),
(EventType.ON_USE_SKILL, ZoneType.CHARACTER_ZONE, self.on_use_skill)
]


class ProspectorsDrill(WeaponCard):
id: int = 311409
name: str = "Prospector's Drill"
name_ch = "勘探钻机"
time = 4.8
weapon_type: WeaponType = WeaponType.POLEARM
cost_num: int = 2
cost_type: CostType = CostType.WHITE

def __init__(self) -> None:
super().__init__()
self.equipment_entity = ProspectorsDrillWeapon

def on_played(self, game: 'GeniusGame') -> None:
super().on_played(game)
4 changes: 3 additions & 1 deletion genius_invocation/card/action/event/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from .events import *
from .base import FoodCard
from .foods import *
from .elemental_resonance import *
from .elemental_resonance_dice import *
from .elemental_resonance_event import *
from .country_resonance import *
from .arcane_legend import*
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def on_played(self, game: 'GeniusGame'):
# 进行对应操作
for idx, character in enumerate(character_list):
if target_point > character.health_point:
character.heal(heal=target_point[idx]-character.health_point, game=game)
character.heal(heal=target_point[idx]-character.health_point, game=game, heal_type=HealType.HEALTH_ASSIGNMENT)
elif target_point < character.health_point:
damage = Damage.create_damage(
game=game,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import os
import importlib

package_dir = os.path.dirname(__file__)
module_files = [
f[:-3] for f in os.listdir(package_dir) if f.endswith(".py") and f != "__init__.py"
]

for module_name in module_files:
import_cmd = f"from .{module_name} import *"
exec(import_cmd)

__all__ = module_files
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import os
import importlib

package_dir = os.path.dirname(__file__)
module_files = [
f[:-3] for f in os.listdir(package_dir) if f.endswith(".py") and f != "__init__.py"
]

for module_name in module_files:
import_cmd = f"from .{module_name} import *"
exec(import_cmd)

__all__ = module_files
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ def on_calculate(self, game:'GeniusGame'):
def on_change(self, game:'GeniusGame'):
self.on_calculate(game)

def on_end(self, game:'GeniusGame'):
self.on_destroy(game)

def update_listener_list(self):
self.listeners = [
(EventType.CALCULATE_DICE, ZoneType.ACTIVE_ZONE, self.on_calculate),
(EventType.ON_CHANGE_CHARACTER, ZoneType.ACTIVE_ZONE, self.on_change)
(EventType.ON_CHANGE_CHARACTER, ZoneType.ACTIVE_ZONE, self.on_change),
(EventType.FINAL_END, ZoneType.ACTIVE_ZONE, self.on_end),
]

class Falls_and_Fortune(ActionCard):
Expand Down
48 changes: 48 additions & 0 deletions genius_invocation/card/action/event/events/LoseMoney.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from genius_invocation.card.action.base import ActionCard
from genius_invocation.utils import *
from genius_invocation.entity.status import Combat_Status
if TYPE_CHECKING:
from genius_invocation.game.game import GeniusGame

class LoseMoneyEntity(Combat_Status):
id = 33203631
name: str = "I'd Rather Lose Money Myself..."
name_ch = '「看到那小子挣钱…」'
def __init__(self, game: 'GeniusGame', from_player: 'GeniusPlayer', from_character=None):
super().__init__(game, from_player, from_character)
self.current_usage = 1

def on_get_dice(self, game:'GeniusGame'):
if game.current_player.index == 1 - self.from_player.index:
self.current_usage += 1
if self.current_usage == 2:
self.from_player.dice_zone.add([DiceType.OMNI.value])

def on_end(self, game:'GeniusGame'):
self.on_destroy(game)

def update_listener_list(self):
self.listeners = [
(EventType.ON_GET_DICE, ZoneType.ACTIVE_ZONE, self.on_get_dice),
(EventType.FINAL_END, ZoneType.ACTIVE_ZONE, self.on_end)
]

class LoseMoney(ActionCard):
id: int = 332036
name: str = "I'd Rather Lose Money Myself..."
name_ch = '「看到那小子挣钱…」'
time = 4.8
cost_num = 0
cost_type = None
card_type = ActionCardType.EVENT

def __init__(self) -> None:
super().__init__()

def on_played(self, game: 'GeniusGame'):
zone = game.active_player.team_combat_status
if not zone.has_status(LoseMoneyEntity):
zone.add_entity(LoseMoneyEntity(game, game.active_player, None))

def find_target(self, game:'GeniusGame'):
return [1]
Loading

0 comments on commit 1da1437

Please sign in to comment.