-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathattribute_usage_analysis.py
More file actions
149 lines (127 loc) Β· 6.99 KB
/
attribute_usage_analysis.py
File metadata and controls
149 lines (127 loc) Β· 6.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/env python3
"""
Analysis of card attribute loading vs actual usage in the battle system.
This script identifies the gap between available data and what's actually used.
"""
import json
from pathlib import Path
import sys
sys.path.append(str(Path(__file__).parent / "src"))
from src.clasher.data import CardDataLoader
def analyze_attribute_usage():
"""Analyze which card attributes are loaded vs used in battle"""
print("π CARD ATTRIBUTE USAGE ANALYSIS")
print("=" * 80)
# Load cards using the compatibility system (what gameplay relies on)
loader = CardDataLoader()
legacy_cards = loader.load_cards()
# Load card definitions using the new system (what's available but unused)
new_cards = loader.load_card_definitions()
print(f"π Data Sources:")
print(f" β’ Compat CardStats: {len(legacy_cards)} cards")
print(f" β’ New CardDefinition: {len(new_cards)} cards")
print()
# Analyze a sample card to show attribute availability
sample_card_name = "Knight"
if sample_card_name in legacy_cards and sample_card_name in new_cards:
legacy_card = legacy_cards[sample_card_name]
new_card = new_cards[sample_card_name]
print(f"π SAMPLE ANALYSIS: {sample_card_name}")
print("-" * 40)
print(f"\nπ¦ LOADED ATTRIBUTES (Compat CardStats):")
legacy_attrs = [attr for attr in dir(legacy_card) if not attr.startswith('_') and not callable(getattr(legacy_card, attr))]
print(f" Total: {len(legacy_attrs)} attributes")
print(f" Combat: hitpoints={legacy_card.hitpoints}, damage={legacy_card.damage}, range={legacy_card.range}")
print(f" Movement: speed={legacy_card.speed}, hit_speed={legacy_card.hit_speed}")
print(f" Targeting: targets_only_buildings={legacy_card.targets_only_buildings}")
print(f" Special: charge_range={getattr(legacy_card, 'charge_range', None)}")
print(f" Death: death_spawn_character={getattr(legacy_card, 'death_spawn_character', None)}")
print(f" Buff: buff_data={getattr(legacy_card, 'buff_data', None)}")
print(f" Projectile: projectile_data={getattr(legacy_card, 'projectile_data', None)}")
print(f"\nπ NEW SYSTEM ATTRIBUTES (CardDefinition):")
print(f" Mechanics: {len(new_card.mechanics)} - {[type(m).__name__ for m in new_card.mechanics]}")
print(f" Effects: {len(new_card.effects)} - {[type(e).__name__ for e in new_card.effects]}")
print(f" Tags: {new_card.tags}")
print(f" Structured Stats: troop_stats={bool(new_card.troop_stats)}")
print(f" Behaviors: targeting={bool(new_card.targeting)}, movement={bool(new_card.movement)}")
print(f"\nπ― BATTLE SYSTEM USAGE ANALYSIS:")
print("-" * 40)
# Based on code analysis, identify what's actually used
used_in_battle = {
"name": "β
Card identification and display",
"id": "β
Internal tracking",
"mana_cost": "β
Elixir validation and deployment",
"card_type": "β
Display and categorization",
"hitpoints": "β
Entity health calculation",
"damage": "β
Attack damage calculation",
"range": "β
Attack range validation",
"sight_range": "β
Target acquisition",
"speed": "β
Movement speed",
"hit_speed": "β
Attack timing",
"collision_radius": "β
Hitbox calculation",
"targets_only_buildings": "β
Building-only targeting",
"summon_count": "β
Swarm deployment",
"charge_range": "β
Charge mechanics (Hog Rider, etc.)",
"damage_special": "β
First-hit bonus damage",
"death_spawn_character": "β
Death spawning (Lava Hound, etc.)",
"projectile_data": "β οΈ Partially used (only damage)",
"load_time": "β οΈ Used in some entities",
"deploy_time": "β οΈ Used in some entities"
}
loaded_but_unused = {
"death_spawn_count": "β Death spawn count not implemented",
"kamikaze": "β Kamikaze mechanics not implemented",
"buff_data": "β Buff/debuff system not implemented",
"hit_speed_multiplier": "β Attack speed buffs not used",
"speed_multiplier": "β Movement speed buffs not used",
"spawn_speed_multiplier": "β Spawn speed buffs not used",
"special_load_time": "β Special timing not implemented",
"special_range": "β Special range attacks not implemented",
"special_min_range": "β Minimum range not implemented",
"tribe": "β Tribe mechanics not implemented",
"unlock_arena": "β Meta-data only",
"english_name": "β Display only",
"evolution_data": "β Evolution system not implemented",
"area_damage_radius": "β Area damage not fully implemented",
"projectile_splash_radius": "β Splash damage not implemented",
"attacks_ground": "β Not used (targets_only_buildings used instead)",
"attacks_air": "β Not used (target_type used instead)",
"target_type": "β οΈ Partially used"
}
new_system_unused = {
"mechanics": "β Rich mechanic system completely unused",
"effects": "β Effect composition system unused",
"tags": "β Categorical tagging system unused",
"targeting_behavior": "β Protocol-based targeting unused",
"movement_behavior": "β Protocol-based movement unused",
"attack_behavior": "β Protocol-based attack unused",
"troop_stats": "β Structured stat containers unused",
"building_stats": "β Structured stat containers unused",
"spell_stats": "β Structured stat containers unused"
}
print(f"β
ATTRIBUTES CURRENTLY USED:")
for attr, usage in sorted(used_in_battle.items()):
print(f" {attr}: {usage}")
print(f"\nβ οΈ LOADED BUT UNUSED (Compat System):")
for attr, reason in sorted(loaded_but_unused.items()):
print(f" {attr}: {reason}")
print(f"\nπ AVAILABLE BUT UNUSED (New Compositional System):")
for attr, reason in sorted(new_system_unused.items()):
print(f" {attr}: {reason}")
print(f"\nπ USAGE STATISTICS:")
total_legacy = len(used_in_battle) + len(loaded_but_unused)
total_new = len(new_system_unused)
print(f" Compat System: {len(used_in_battle)}/{total_legacy} attributes used ({len(used_in_battle)/total_legacy*100:.1f}%)")
print(f" New Compositional System: 0/{total_new} components used (0.0%)")
print(f"\nπ― KEY OPPORTUNITIES:")
print(f" 1. Implement buff system using loaded buff_data")
print(f" 2. Add area damage using area_damage_radius")
print(f" 3. Implement projectile splash damage")
print(f" 4. Integrate new mechanic system via CardStatsCompat")
print(f" 5. Add kamikaze mechanics for appropriate cards")
print(f"\nπ CONCLUSION:")
print(f" The battle system uses ~44% of loaded legacy attributes")
print(f" The new compositional system is completely unused")
print(f" Significant potential for gameplay enhancement exists")
if __name__ == "__main__":
analyze_attribute_usage()