Browse Source

武器伤害倍率

181404010226 2 months ago
parent
commit
8ceecb1da0

BIN
assets/data/excel/__pycache__/generate_excel_from_json.cpython-313.pyc


BIN
assets/data/excel/__pycache__/weapon_config_manager.cpython-313.pyc


+ 38 - 1
assets/data/excel/generate_excel_from_json.py

@@ -230,6 +230,37 @@ class WeaponExcelGenerator:
         df = pd.DataFrame(rarity_data, columns=headers)
         return df
     
+    def create_rarity_damage_multipliers_sheet(self, config_data):
+        """创建稀有度伤害倍率配置工作表"""
+        rarity_damage_multipliers = config_data.get('rarityDamageMultipliers', [])
+        
+        multiplier_data = []
+        headers = ['配置项', '值', '描述']
+        
+        # 将数组转换为逗号分隔的字符串
+        multipliers_str = ', '.join(map(str, rarity_damage_multipliers))
+        
+        # 添加配置行
+        multiplier_data.append([
+            'rarityDamageMultipliers',
+            multipliers_str,
+            '稀有度伤害倍率数组,按等级顺序:[普通, 不常见, 稀有, 史诗]'
+        ])
+        
+        # 添加说明行
+        rarity_level_names = ['普通(common)', '不常见(uncommon)', '稀有(rare)', '史诗(epic)']
+        for i, multiplier in enumerate(rarity_damage_multipliers):
+            if i < len(rarity_level_names):
+                multiplier_data.append([
+                    f'等级{i}',
+                    str(multiplier),
+                    f'{rarity_level_names[i]} - {multiplier}倍伤害'
+                ])
+        
+        # 创建DataFrame
+        df = pd.DataFrame(multiplier_data, columns=headers)
+        return df
+    
     def create_block_shapes_sheet(self, config_data):
         """创建方块形状配置工作表"""
         block_sizes = config_data.get('blockSizes', [])
@@ -288,6 +319,11 @@ class WeaponExcelGenerator:
                 rarity_weights_df.to_excel(writer, sheet_name='稀有度权重配置', index=False)
                 print("✓ 创建稀有度权重配置工作表")
                 
+                # 创建稀有度伤害倍率配置工作表
+                rarity_damage_multipliers_df = self.create_rarity_damage_multipliers_sheet(config_data)
+                rarity_damage_multipliers_df.to_excel(writer, sheet_name='稀有度伤害倍率配置', index=False)
+                print("✓ 创建稀有度伤害倍率配置工作表")
+                
                 # 创建方块形状配置工作表
                 block_shapes_df = self.create_block_shapes_sheet(config_data)
                 block_shapes_df.to_excel(writer, sheet_name='方块形状配置', index=False)
@@ -320,7 +356,8 @@ def main():
         print("  2. 武器升级费用配置 - 包含武器升级的费用和伤害配置")
         print("  3. 游戏内成本配置 - 包含武器在游戏中的购买成本")
         print("  4. 稀有度权重配置 - 包含武器稀有度的权重分布")
-        print("  5. 方块形状配置 - 包含所有方块形状的定义")
+        print("  5. 稀有度伤害倍率配置 - 包含不同稀有度的伤害倍率")
+        print("  6. 方块形状配置 - 包含所有方块形状的定义")
     else:
         print("\n❌ Excel配置表生成失败!")
         return 1

+ 45 - 0
assets/data/excel/remove_sheet.py

@@ -0,0 +1,45 @@
+import pandas as pd
+import openpyxl
+from pathlib import Path
+
+def remove_sheet_from_excel(excel_path, sheet_name_to_remove):
+    """
+    从Excel文件中删除指定的工作表
+    """
+    try:
+        # 使用openpyxl加载工作簿
+        workbook = openpyxl.load_workbook(excel_path)
+        
+        # 检查工作表是否存在
+        if sheet_name_to_remove in workbook.sheetnames:
+            # 删除工作表
+            del workbook[sheet_name_to_remove]
+            print(f"已删除工作表: {sheet_name_to_remove}")
+            
+            # 保存文件
+            workbook.save(excel_path)
+            print(f"文件已保存: {excel_path}")
+            
+            # 显示剩余的工作表
+            print(f"剩余工作表: {workbook.sheetnames}")
+            return True
+        else:
+            print(f"工作表 '{sheet_name_to_remove}' 不存在")
+            print(f"现有工作表: {workbook.sheetnames}")
+            return False
+            
+    except Exception as e:
+        print(f"删除工作表失败: {e}")
+        return False
+
+if __name__ == "__main__":
+    excel_file = Path("d:/CocosGame/Pong/assets/data/excel/方块武器配置/方块武器配置表.xlsx")
+    sheet_to_remove = "稀有度权重配置"
+    
+    print(f"正在从 {excel_file} 中删除工作表 '{sheet_to_remove}'...")
+    success = remove_sheet_from_excel(excel_file, sheet_to_remove)
+    
+    if success:
+        print("\n✅ 工作表删除成功!")
+    else:
+        print("\n❌ 工作表删除失败!")

+ 12 - 0
assets/data/excel/remove_sheet.py.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.0.0",
+  "importer": "*",
+  "imported": true,
+  "uuid": "9763ea5c-2165-4649-877b-0772fbec652b",
+  "files": [
+    ".json",
+    ".py"
+  ],
+  "subMetas": {},
+  "userData": {}
+}

+ 236 - 2
assets/data/excel/weapon_config_manager.py

@@ -56,6 +56,7 @@ class WeaponConfigManager:
                 '射速': float,
                 '射程': int,
                 '子弹速度': int,
+                '稀有度伤害倍率': str,  # 逗号分隔的数组字符串
                 # 方块价格配置字段
                 '基础每格成本': int,
                 'I形状成本': int,
@@ -72,6 +73,7 @@ class WeaponConfigManager:
                 'fireRate': float,
                 'range': int,
                 'bulletSpeed': int,
+                'rarityDamageMultipliers': str,  # 逗号分隔的数组字符串
                 'baseCost': int,
                 'I_shape_cost': int,
                 'HI_shape_cost': int,
@@ -163,6 +165,9 @@ class WeaponConfigManager:
             if block_shape_sheet is not None:
                 weapons_config['blockSizes'] = self._parse_block_shape_data(block_shape_sheet)
             
+            # 注意:稀有度权重配置和稀有度伤害倍率配置现在已经移到武器基础配置表中
+            # 不再需要单独的工作表解析
+            
             return weapons_config
             
         except Exception as e:
@@ -201,9 +206,27 @@ class WeaponConfigManager:
                                 elif param_type == float:
                                     item[col_name] = float(value)
                                 else:
-                                    item[col_name] = str(value).strip()
+                                    # 特殊处理稀有度伤害倍率字段
+                                    if col_name in ['稀有度伤害倍率', 'rarityDamageMultipliers']:
+                                        # 将逗号分隔的字符串转换为浮点数数组
+                                        multipliers_str = str(value).strip()
+                                        if multipliers_str:
+                                            try:
+                                                multipliers = [float(x.strip()) for x in multipliers_str.split(',') if x.strip()]
+                                                item[col_name] = multipliers
+                                            except ValueError:
+                                                # 如果解析失败,使用默认值
+                                                item[col_name] = [1.0, 1.5, 2.25, 8.0]
+                                        else:
+                                            item[col_name] = [1.0, 1.5, 2.25, 8.0]
+                                    else:
+                                        item[col_name] = str(value).strip()
                             except (ValueError, TypeError):
-                                item[col_name] = str(value).strip()
+                                # 特殊处理稀有度伤害倍率字段的异常情况
+                                if col_name in ['稀有度伤害倍率', 'rarityDamageMultipliers']:
+                                    item[col_name] = [1.0, 1.5, 2.25, 8.0]
+                                else:
+                                    item[col_name] = str(value).strip()
                 
                 # 检查是否有有效的武器ID
                 weapon_id = item.get('ID') or item.get('id') or item.get('武器ID')
@@ -547,6 +570,203 @@ class WeaponConfigManager:
             print(f"解析形状矩阵失败: {e}, 使用默认矩阵")
             return [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
     
+    def _parse_rarity_weights_data(self, rarity_weights_sheet):
+        """解析稀有度权重配置数据"""
+        try:
+            print(f"开始处理稀有度权重配置,工作表行数: {len(rarity_weights_sheet)}")
+            rarity_weights = {}
+            
+            # 检查第一行是否为表头
+            first_row = rarity_weights_sheet.iloc[0] if len(rarity_weights_sheet) > 0 else None
+            is_header = False
+            if first_row is not None:
+                first_cell = str(first_row.iloc[0]).strip() if len(first_row) > 0 else ""
+                if first_cell in ['稀有度', 'Rarity', 'rarity', '等级']:
+                    is_header = True
+                    print(f"检测到表头行,第一列内容: {first_cell}")
+            
+            for index, row in rarity_weights_sheet.iterrows():
+                if is_header and index == 0:  # 跳过表头
+                    continue
+                
+                # 获取稀有度名称
+                rarity_name = None
+                for field in ['稀有度', 'Rarity', 'rarity', '等级']:
+                    if field in row and pd.notna(row[field]):
+                        rarity_name = str(row[field]).strip().lower()
+                        break
+                
+                if rarity_name is None and len(row) > 0:
+                    rarity_name = str(row.iloc[0]).strip().lower() if pd.notna(row.iloc[0]) else None
+                
+                # 获取权重值
+                weight = None
+                for field in ['权重', 'Weight', 'weight', '值']:
+                    if field in row and pd.notna(row[field]):
+                        try:
+                            weight = int(float(row[field]))
+                            break
+                        except (ValueError, TypeError):
+                            pass
+                
+                if weight is None and len(row) > 1:
+                    try:
+                        weight = int(float(row.iloc[1])) if pd.notna(row.iloc[1]) else None
+                    except (ValueError, TypeError):
+                        pass
+                
+                # 映射中文稀有度名称到英文
+                rarity_mapping = {
+                    '普通': 'common',
+                    '稀有': 'uncommon', 
+                    '史诗': 'rare',
+                    '传说': 'epic',
+                    'common': 'common',
+                    'uncommon': 'uncommon',
+                    'rare': 'rare',
+                    'epic': 'epic'
+                }
+                
+                if rarity_name and weight is not None:
+                    mapped_rarity = rarity_mapping.get(rarity_name, rarity_name)
+                    rarity_weights[mapped_rarity] = weight
+                    print(f"✓ 添加稀有度权重配置: {mapped_rarity} = {weight}")
+            
+            return rarity_weights
+            
+        except Exception as e:
+            print(f"解析稀有度权重配置失败: {e}")
+            return {}
+    
+    def _parse_rarity_damage_multipliers_data(self, rarity_damage_multipliers_sheet):
+        """解析稀有度伤害倍率配置数据"""
+        try:
+            print(f"开始处理稀有度伤害倍率配置,工作表行数: {len(rarity_damage_multipliers_sheet)}")
+            damage_multipliers = []
+            
+            # 检查第一行是否为表头
+            first_row = rarity_damage_multipliers_sheet.iloc[0] if len(rarity_damage_multipliers_sheet) > 0 else None
+            is_header = False
+            if first_row is not None:
+                first_cell = str(first_row.iloc[0]).strip() if len(first_row) > 0 else ""
+                if first_cell in ['配置项', 'Config Item', 'config_item', '等级', 'Level', 'level', '稀有度等级']:
+                    is_header = True
+                    print(f"检测到表头行,第一列内容: {first_cell}")
+            
+            for index, row in rarity_damage_multipliers_sheet.iterrows():
+                if is_header and index == 0:  # 跳过表头
+                    continue
+                
+                # 获取配置项名称
+                config_item = None
+                for field in ['配置项', 'Config Item', 'config_item']:
+                    if field in row and pd.notna(row[field]):
+                        config_item = str(row[field]).strip()
+                        break
+                
+                if config_item is None and len(row) > 0:
+                    config_item = str(row.iloc[0]).strip() if pd.notna(row.iloc[0]) else None
+                
+                # 如果找到rarityDamageMultipliers配置项
+                if config_item == 'rarityDamageMultipliers':
+                    # 获取值字段
+                    multipliers_str = None
+                    for field in ['值', 'Value', 'value']:
+                        if field in row and pd.notna(row[field]):
+                            multipliers_str = str(row[field]).strip()
+                            break
+                    
+                    if multipliers_str is None and len(row) > 1:
+                        multipliers_str = str(row.iloc[1]).strip() if pd.notna(row.iloc[1]) else None
+                    
+                    if multipliers_str:
+                        try:
+                            # 解析逗号分隔的数组字符串
+                            multipliers_list = [float(x.strip()) for x in multipliers_str.split(',')]
+                            damage_multipliers = multipliers_list
+                            print(f"✓ 解析稀有度伤害倍率配置: {damage_multipliers}")
+                            break
+                        except (ValueError, TypeError) as e:
+                            print(f"解析倍率数组失败: {e}, 字符串: {multipliers_str}")
+            
+            # 如果没有找到配置或解析失败,尝试旧格式解析
+            if not damage_multipliers:
+                print("未找到新格式配置,尝试解析旧格式...")
+                level_multipliers = {}
+                
+                for index, row in rarity_damage_multipliers_sheet.iterrows():
+                    if is_header and index == 0:  # 跳过表头
+                        continue
+                    
+                    # 获取稀有度等级
+                    level = None
+                    for field in ['等级', 'Level', 'level', '稀有度等级']:
+                        if field in row and pd.notna(row[field]):
+                            try:
+                                level_str = str(row[field]).strip()
+                                if level_str.startswith('等级'):
+                                    level = int(level_str.replace('等级', ''))
+                                else:
+                                    level = int(float(row[field]))
+                                break
+                            except (ValueError, TypeError):
+                                pass
+                    
+                    if level is None and len(row) > 0:
+                        try:
+                            first_cell = str(row.iloc[0]).strip()
+                            if first_cell.startswith('等级'):
+                                level = int(first_cell.replace('等级', ''))
+                            else:
+                                level = int(float(row.iloc[0])) if pd.notna(row.iloc[0]) else None
+                        except (ValueError, TypeError):
+                            pass
+                    
+                    # 获取伤害倍率
+                    multiplier = None
+                    for field in ['伤害倍率', 'Damage Multiplier', 'multiplier', '倍率', '值', 'Value', 'value']:
+                        if field in row and pd.notna(row[field]):
+                            try:
+                                multiplier = float(row[field])
+                                break
+                            except (ValueError, TypeError):
+                                pass
+                    
+                    if multiplier is None and len(row) > 1:
+                        try:
+                            multiplier = float(row.iloc[1]) if pd.notna(row.iloc[1]) else None
+                        except (ValueError, TypeError):
+                            pass
+                    
+                    if level is not None and multiplier is not None:
+                        level_multipliers[level] = multiplier
+                        print(f"✓ 添加稀有度伤害倍率配置: 等级{level} = {multiplier}倍")
+                
+                # 将字典转换为按等级排序的数组
+                if level_multipliers:
+                    max_level = max(level_multipliers.keys())
+                    for i in range(max_level + 1):
+                        if i in level_multipliers:
+                            damage_multipliers.append(level_multipliers[i])
+                        else:
+                            # 使用默认值
+                            default_multipliers = [1, 1.5, 2.25, 8]
+                            if i < len(default_multipliers):
+                                damage_multipliers.append(default_multipliers[i])
+                            else:
+                                damage_multipliers.append(1)
+            
+            # 如果仍然没有数据,使用默认值
+            if not damage_multipliers:
+                damage_multipliers = [1, 1.5, 2.25, 8]
+                print("使用默认稀有度伤害倍率配置")
+            
+            return damage_multipliers
+            
+        except Exception as e:
+            print(f"解析稀有度伤害倍率配置失败: {e}")
+            return [1, 1.5, 2.25, 8]  # 返回默认值
+    
     def merge_weapon_configs(self, existing_config, excel_config):
         """合并现有JSON配置和Excel配置"""
         try:
@@ -595,6 +815,13 @@ class WeaponConfigManager:
                 merged_config['blockSizes'] = excel_config['blockSizes']
                 print(f"✓ 更新方块形状配置,共{len(excel_config['blockSizes'])}个形状")
             
+            # 保留重要的全局配置字段
+            global_config_fields = ['rarityWeights', 'rarityDamageMultipliers']
+            for field in global_config_fields:
+                if field in existing_config:
+                    merged_config[field] = existing_config[field]
+                    print(f"✓ 保留全局配置: {field}")
+            
             print(f"合并完成,最终武器数量: {len(merged_weapons)}")
             return merged_config
             
@@ -621,6 +848,12 @@ class WeaponConfigManager:
             weapon_type = item.get('type', item.get('类型', ''))
             weight = item.get('weight', item.get('权重', 1))
             
+            # 获取稀有度伤害倍率
+            rarity_damage_multipliers = item.get('rarityDamageMultipliers', item.get('稀有度伤害倍率', [1.0, 1.5, 2.25, 8.0]))
+            # 确保是数组格式
+            if not isinstance(rarity_damage_multipliers, list):
+                rarity_damage_multipliers = [1.0, 1.5, 2.25, 8.0]
+            
             # 推断武器类型(如果为空)
             if not weapon_type:
                 weapon_type = self._infer_weapon_type(weapon_id)
@@ -635,6 +868,7 @@ class WeaponConfigManager:
                 'name': weapon_name,
                 'type': weapon_type,
                 'weight': weight,
+                'rarityDamageMultipliers': rarity_damage_multipliers,
                 'stats': {
                     'damage': damage,
                     'fireRate': fire_rate,

BIN
assets/data/excel/方块武器配置/方块武器配置表.xlsx


+ 313 - 101
assets/data/weapons.json

@@ -5,6 +5,12 @@
       "name": "毛豆射手",
       "type": "single_shot",
       "weight": 30,
+      "rarityDamageMultipliers": [
+        1.0,
+        2.0,
+        4.0,
+        8.0
+      ],
       "stats": {
         "damage": 10,
         "fireRate": 10.0,
@@ -104,10 +110,6 @@
           "L": 30,
           "S": 40,
           "D-T": 40,
-          "L2": 30,
-          "L3": 30,
-          "L4": 30,
-          "F-S": 40,
           "T": 40
         }
       }
@@ -117,6 +119,12 @@
       "name": "尖胡萝卜",
       "type": "piercing",
       "weight": 25,
+      "rarityDamageMultipliers": [
+        1.0,
+        1.5,
+        2.25,
+        8.0
+      ],
       "stats": {
         "damage": 8,
         "fireRate": 10.0,
@@ -219,10 +227,6 @@
           "L": 36,
           "S": 48,
           "D-T": 48,
-          "L2": 36,
-          "L3": 36,
-          "L4": 36,
-          "F-S": 48,
           "T": 48
         }
       }
@@ -232,6 +236,12 @@
       "name": "锯齿草",
       "type": "ricochet_piercing",
       "weight": 20,
+      "rarityDamageMultipliers": [
+        1.0,
+        1.5,
+        2.25,
+        8.0
+      ],
       "stats": {
         "damage": 8,
         "fireRate": 10.0,
@@ -339,10 +349,6 @@
           "L": 36,
           "S": 48,
           "D-T": 48,
-          "L2": 36,
-          "L3": 36,
-          "L4": 36,
-          "F-S": 48,
           "T": 48
         }
       }
@@ -352,6 +358,12 @@
       "name": "西瓜炸弹",
       "type": "explosive",
       "weight": 15,
+      "rarityDamageMultipliers": [
+        1.0,
+        1.5,
+        2.25,
+        8.0
+      ],
       "stats": {
         "damage": 15,
         "fireRate": 10.0,
@@ -454,10 +466,6 @@
           "L": 60,
           "S": 80,
           "D-T": 80,
-          "L2": 60,
-          "L3": 60,
-          "L4": 60,
-          "F-S": 80,
           "T": 80
         }
       }
@@ -467,6 +475,12 @@
       "name": "回旋镖盆栽",
       "type": "boomerang",
       "weight": 18,
+      "rarityDamageMultipliers": [
+        1.0,
+        1.5,
+        2.25,
+        8.0
+      ],
       "stats": {
         "damage": 10,
         "fireRate": 10.0,
@@ -567,10 +581,6 @@
           "L": 36,
           "S": 48,
           "D-T": 48,
-          "L2": 36,
-          "L3": 36,
-          "L4": 36,
-          "F-S": 48,
           "T": 48
         }
       }
@@ -580,6 +590,12 @@
       "name": "炙热辣椒",
       "type": "area_burn",
       "weight": 12,
+      "rarityDamageMultipliers": [
+        1.0,
+        1.5,
+        2.25,
+        8.0
+      ],
       "stats": {
         "damage": 15,
         "fireRate": 10.0,
@@ -688,10 +704,6 @@
           "L": 60,
           "S": 80,
           "D-T": 80,
-          "L2": 60,
-          "L3": 60,
-          "L4": 60,
-          "F-S": 80,
           "T": 80
         }
       }
@@ -701,6 +713,12 @@
       "name": "仙人散弹",
       "type": "shotgun",
       "weight": 22,
+      "rarityDamageMultipliers": [
+        1.0,
+        1.5,
+        2.25,
+        8.0
+      ],
       "stats": {
         "damage": 6,
         "fireRate": 10.0,
@@ -801,10 +819,6 @@
           "L": 60,
           "S": 80,
           "D-T": 80,
-          "L2": 60,
-          "L3": 60,
-          "L4": 60,
-          "F-S": 80,
           "T": 80
         }
       }
@@ -814,6 +828,12 @@
       "name": "秋葵导弹",
       "type": "homing_missile",
       "weight": 8,
+      "rarityDamageMultipliers": [
+        1.0,
+        1.5,
+        2.25,
+        8.0
+      ],
       "stats": {
         "damage": 20,
         "fireRate": 10.0,
@@ -917,10 +937,6 @@
           "L": 90,
           "S": 120,
           "D-T": 120,
-          "L2": 90,
-          "L3": 90,
-          "L4": 90,
-          "F-S": 120,
           "T": 120
         }
       }
@@ -930,6 +946,12 @@
       "name": "狼牙棒",
       "type": "melee",
       "weight": 20,
+      "rarityDamageMultipliers": [
+        1.0,
+        1.5,
+        2.25,
+        8.0
+      ],
       "stats": {
         "damage": 25,
         "fireRate": 8.0,
@@ -1036,10 +1058,6 @@
           "L": 24,
           "S": 32,
           "D-T": 32,
-          "L2": 33,
-          "L3": 33,
-          "L4": 33,
-          "F-S": 33,
           "T": 33
         }
       }
@@ -1051,13 +1069,33 @@
       "name": "I形",
       "shape": [
         [
-          1,
-          0,
-          0,
-          0
+          [
+            1,
+            0,
+            0,
+            0
+          ],
+          [
+            1,
+            0,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ]
         ],
         [
-          1,
+          0,
           0,
           0,
           0
@@ -1084,14 +1122,34 @@
       "name": "横I形",
       "shape": [
         [
-          0,
-          0,
-          0,
-          0
+          [
+            0,
+            0,
+            0,
+            0
+          ],
+          [
+            1,
+            1,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ]
         ],
         [
-          1,
-          1,
+          0,
+          0,
           0,
           0
         ],
@@ -1117,14 +1175,34 @@
       "name": "L形",
       "shape": [
         [
-          1,
-          0,
-          0,
-          0
+          [
+            1,
+            0,
+            0,
+            0
+          ],
+          [
+            1,
+            1,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ]
         ],
         [
-          1,
-          1,
+          0,
+          0,
           0,
           0
         ],
@@ -1150,14 +1228,34 @@
       "name": "S形",
       "shape": [
         [
-          0,
-          1,
-          1,
-          0
+          [
+            0,
+            1,
+            1,
+            0
+          ],
+          [
+            1,
+            1,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ]
         ],
         [
-          1,
-          1,
+          0,
+          0,
           0,
           0
         ],
@@ -1183,15 +1281,35 @@
       "name": "倒T形",
       "shape": [
         [
-          0,
-          1,
-          0,
-          0
+          [
+            0,
+            1,
+            0,
+            0
+          ],
+          [
+            1,
+            1,
+            1,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ]
         ],
         [
-          1,
-          1,
-          1,
+          0,
+          0,
+          0,
           0
         ],
         [
@@ -1216,14 +1334,34 @@
       "name": "L2形",
       "shape": [
         [
-          1,
-          1,
-          0,
-          0
+          [
+            1,
+            1,
+            0,
+            0
+          ],
+          [
+            0,
+            1,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ]
         ],
         [
           0,
-          1,
+          0,
           0,
           0
         ],
@@ -1249,14 +1387,34 @@
       "name": "L3形",
       "shape": [
         [
-          1,
-          0,
-          0,
-          0
+          [
+            1,
+            0,
+            0,
+            0
+          ],
+          [
+            1,
+            1,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ]
         ],
         [
-          1,
-          1,
+          0,
+          0,
           0,
           0
         ],
@@ -1282,14 +1440,34 @@
       "name": "L4形",
       "shape": [
         [
-          0,
-          1,
-          0,
-          0
+          [
+            0,
+            1,
+            0,
+            0
+          ],
+          [
+            1,
+            1,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ]
         ],
         [
-          1,
-          1,
+          0,
+          0,
           0,
           0
         ],
@@ -1315,15 +1493,35 @@
       "name": "S-F形",
       "shape": [
         [
-          1,
-          1,
-          0,
-          0
+          [
+            1,
+            1,
+            0,
+            0
+          ],
+          [
+            0,
+            1,
+            1,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ]
         ],
         [
           0,
-          1,
-          1,
+          0,
+          0,
           0
         ],
         [
@@ -1348,14 +1546,34 @@
       "name": "T形",
       "shape": [
         [
-          1,
-          1,
-          1,
-          0
+          [
+            1,
+            1,
+            1,
+            0
+          ],
+          [
+            0,
+            1,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ],
+          [
+            0,
+            0,
+            0,
+            0
+          ]
         ],
         [
           0,
-          1,
+          0,
           0,
           0
         ],
@@ -1376,11 +1594,5 @@
       "costMultiplier": 4,
       "description": "T型形状"
     }
-  ],
-  "rarityWeights": {
-    "common": 60,
-    "uncommon": 25,
-    "rare": 12,
-    "epic": 3
-  }
+  ]
 }

+ 0 - 37
assets/scripts/CombatSystem/BlockManager.ts

@@ -1479,43 +1479,6 @@ export class BlockManager extends Component {
         return null;
     }
     
-    // 根据稀有度设置方块价格
-    private setBlockPriceByRarity(priceNode: Node, rarity: string) {
-        const label = priceNode.getComponent(Label);
-        if (!label) {
-            return;
-        }
-        
-        let basePrice: number;
-        switch (rarity) {
-            case 'common':
-                basePrice = 0;
-                break;
-            case 'uncommon':
-                basePrice = 20;
-                break;
-            case 'rare':
-                basePrice = 50;
-                break;
-            case 'epic':
-                basePrice = 100;
-                break;
-
-            default:
-                basePrice = 0;
-        }
-        
-        // 应用便宜技能效果
-        const skillManager = SkillManager.getInstance();
-        let finalPrice = basePrice;
-        if (skillManager) {
-            const cheaperSkillLevel = skillManager.getSkillLevel('cheaper_units');
-            finalPrice = Math.ceil(SkillManager.calculateCheaperUnitsPrice(basePrice, cheaperSkillLevel));
-        }
-        
-        label.string = finalPrice.toString();
-    }
-
     // 根据武器配置和方块形状设置价格
     private setBlockPriceByWeaponConfig(block: Node, priceNode: Node) {
         const label = priceNode.getComponent(Label);

+ 9 - 17
assets/scripts/CombatSystem/WeaponBullet.ts

@@ -838,24 +838,7 @@ export class WeaponBullet extends Component {
         return this.weaponConfig?.runtimeStats?.critChance || 0;
     }
     
-    /**
-     * 根据稀有度获取伤害倍数
-     */
-    private getRarityDamageMultiplier(rarity: string): number {
-        switch (rarity) {
-            case 'common':
-                return 1; // 1级,无倍数
-            case 'uncommon':
-                return 1.5; // 2级,1.5倍伤害
-            case 'rare':
-                return 2.25; // 3级,2.25倍伤害
-            case 'epic':
-                return 8; // 4级,8倍伤害
 
-            default:
-                return 1;
-        }
-    }
 
     /**
      * 根据稀有度等级获取伤害倍数
@@ -863,6 +846,15 @@ export class WeaponBullet extends Component {
      * @returns 伤害倍数
      */
     private getRarityDamageMultiplierByLevel(rarityLevel: number): number {
+        // 优先使用当前武器的稀有度伤害倍率配置
+        if (this.weaponConfig && this.weaponConfig.rarityDamageMultipliers && Array.isArray(this.weaponConfig.rarityDamageMultipliers)) {
+            const multipliers = this.weaponConfig.rarityDamageMultipliers;
+            if (rarityLevel >= 0 && rarityLevel < multipliers.length) {
+                return multipliers[rarityLevel];
+            }
+        }
+        
+        // 如果当前武器配置不存在,使用默认值
         switch (rarityLevel) {
             case 0: // common
                 return 1; // 1级,无倍数

+ 5 - 1
assets/scripts/Core/ConfigManager.ts

@@ -99,6 +99,7 @@ export interface WeaponConfig {
             };
         };
     };
+    rarityDamageMultipliers?: number[]; // 稀有度伤害倍率数组
     // 运行时计算的实际数值(应用技能加成后)
     runtimeStats?: {
         finalDamage: number;
@@ -450,7 +451,10 @@ export class ConfigManager extends BaseSingleton {
         return this.weaponsConfig.weapons.filter(weapon => weapon.rarity === rarity);
     }
 
-
+    // 获取完整的武器配置对象
+    public getWeaponsConfig(): any {
+        return this.weaponsConfig;
+    }
 
     // 获取方块尺寸列表(已更新为形状ID)
     public getBlockSizes(): string[] {

+ 1 - 0
assets/scripts/FourUI/UpgradeSystem/UpgradeController.ts

@@ -41,6 +41,7 @@ interface WeaponConfig {
             };
         };
     };
+    rarityDamageMultipliers?: number[]; // 稀有度伤害倍率数组
 }
 
 /**