| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918 |
- import random
- import game.const.game as G
- import game.const.rouge as R
- import game.const.rouge_theme as T
- def randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type, symmetric=False):
- # 其中n为该区难度
- # alpha为第二只及以上的重复怪物的权重系数,取值范围(0,1),通常为0.5
- # beta为怪的随机变难因子(容忍最后加的这只怪最终超出地图难度多少) ( max{单怪难度+剩余可分配难度}=beta ),通常为8
- # minDiff为进行随机抽取的最低剩余可分配难度,当剩余难度比此值低时则强制选取1只怪,通常为3
- # minName为字符串:"**",即强制选取的怪物名称
- break_time = 0
- district=[]
- diffList=[]
- # 初始化三个空的列表,用于存储不同类型的主键
- normal_keys = []
- elite_keys = []
- boss_keys = []
- normal_elite_keys = []
- elite_boss_keys = []
- all_keys = []
- has_boss = False
- # 遍历原始字典,根据"type"字段分类主键
- for key, value in mon_dic.items():
- if value['type'] == 'normal':
- normal_keys.append(key)
- normal_elite_keys.append(key)
- all_keys.append(key)
- elif value['type'] == 'elite':
- elite_keys.append(key)
- normal_elite_keys.append(key)
- elite_boss_keys.append(key)
- all_keys.append(key)
- elif value['type'] == 'boss':
- boss_keys.append(key)
- elite_boss_keys.append(key)
- all_keys.append(key)
- if cell_type == "single_boss" or cell_type == "mix_boss":
- n = int(n*1.2)
- if R.difficulty == "Easy":
- rd = random.randint(0,1)
- elif R.difficulty == "Normal":
- rd = random.randint(-1,1)
- else:
- rd = random.randint(-2,1)
- while sum(diffList) < n:
- name = None
- break_time += 1
- if len(district) > 5-random.randint(0,1):
- break
- else:
- if R.difficulty == "Easy" and len(district) > 4-random.randint(0,1):
- break
- if cell_type == "elite":
- if len(district) > R.diff_elite_num[R.difficulty]-rd:
- break
- if cell_type == "elite_normal":
- if len(district) > R.diff_elite_normal_num[R.difficulty]-rd:
- break
- if break_time >= 10000:
- if cell_type == "single_boss" or "mix_boss":
- name = random.choice(normal_elite_keys)
- district.append(name)
- diffList.append(mon_dic[name]["diff"])
- else:
- district.append(minName)
- diffList.append(minDiff)
- break
- # 开始分怪
- if cell_type == "normal":
- name = random.choice(normal_keys)
- if cell_type == "normal_elite":
- name = random.choice(normal_elite_keys)
- if cell_type == "elite":
- name = random.choice(elite_keys)
- if cell_type == "single_boss":
- name = random.choice(boss_keys)
- if cell_type == "mix_boss":
- if not has_boss:
- has_boss = True
- name = random.choice(boss_keys)
- else:
- name = random.choice(elite_boss_keys)
- if break_time >= 1000:
- if cell_type == "single_boss" or "mix_boss":
- name = random.choice(normal_elite_keys)
- difficulty = mon_dic[name]["diff"]
- if district.count(name) >= mon_dic[name]["max"] or (symmetric and mon_dic[name]["max"]<=2):
- continue
- if district.count(name) >= 1:
- difficulty = round(difficulty * (alpha + (1.5*(1-alpha))/district.count(name)),1)
- if n-sum(diffList)<=minDiff:
- district.append(minName)
- diffList.append(minDiff+1)
- continue
- else:
- if difficulty > n-sum(diffList)+beta:
- continue
- else:
- if district.count(name) == 0:
- difficulty = max(difficulty*1.4, difficulty+6)
- district.append(name)
- diffList.append(difficulty)
- # print(diffList,",难度系数=", sum(diffList))
- return district, diffList
- def setable(list):
- return [tuple(item) for item in list]
- hole_type_map = {
- 1: [[7,7],[7,8],[7,9],[8,7],[8,8],[8,9],[9,7],[9,8],[9,9]],
- 2: [[7,7],[7,8],[7,9],[8,7],[8,8],[8,9],[9,7],[9,8],[9,9],[6,8],[8,6],[8,10],[10,8]],
- 3: [[6,7],[7,6],[7,7], [9,6],[9,7],[10,7], [6,9],[7,9],[7,10], [9,9],[9,10],[10,9]],
- 4: [[7,8],[8,7],[8,8],[8,9],[9,8], [4,4],[4,5],[5,4],[5,5], [11,11],[11,12],[12,11],[12,12], [11,4],[11,5],[12,4],[12,5], [4,11],[4,12],[5,11],[5,12]],
- 5: [[2,8],[3,8],[4,8],[5,8],[6,8],[7,9],[8,10],[8,13],[8,14],[8,2],[8,3],[8,6],[9,7],[10,8],[11,8],[12,8],[13,8],[14,8]], # 四宫格
- 6: [[5,7],[5,9],[6,6],[6,10],[7,5],[7,11],[11,7],[11,9],[10,6],[10,10],[9,5],[9,11]],
- 7: [(7, 7), (7, 9), (9, 9), (9, 7), (11, 8), (8, 5), (5, 8), (8, 11), (7, 13), (9, 13), (11, 13), (13, 12), (5, 13), (3, 12), (3, 10), (13, 10), (7, 3), (9, 3), (11, 3), (5, 3), (3, 4), (3, 6), (13, 6), (13, 4), (3, 8), (13, 8)], # 散点地形
- 8: [(3, 11), (5, 11), (6, 9), (6, 8), (6, 7), (7, 4), (8, 4), (9, 4), (10, 4), (11, 4), (12, 4), (8, 8), (8, 9), (8, 10), (8, 11), (6, 6), (8, 7), (8, 6), (10, 6), (11, 6), (12, 7), (12, 8), (11, 9), (10, 9), (12, 10), (12, 11), (11, 12), (10, 12), (8, 12), (6, 10), (5, 12), (4, 10), (3, 12)], # sqrt13
- 9: [(4, 10), (4, 9), (4, 8), (7, 12), (9, 12), (5, 11), (6, 11), (10, 11), (11, 11), (12, 10), (12, 9), (12, 8), (12, 7), (4, 7), (5, 6), (11, 6), (8, 3), (8, 4), (8, 5), (8, 6), (8, 7), (8, 8), (8, 9), (10, 5), (6, 5), (8, 12)], # 关机图标
- 10: [(5, 4), (6, 4), (10, 4), (11, 4), (12, 5), (12, 6), (9, 10), (9, 11), (5, 9), (6, 9), (4, 10), (4, 11), (5, 12), (6, 12), (12, 10), (12, 11), (11, 12), (10, 12), (10, 7), (11, 7), (7, 6), (7, 5), (4, 5), (4, 6), (10, 9), (7, 10), (6, 7), (9, 6)], # 4个C
- 11: [(8, 7), (7, 6), (6, 6), (5, 7), (6, 8), (5, 8), (6, 9), (7, 10), (8, 11), (9, 10), (10, 9), (11, 8), (11, 7), (10, 6), (9, 6), (10, 8), (10, 7), (9, 7), (9, 8), (9, 9), (8, 8), (8, 10), (8, 9), (7, 7), (6, 7), (7, 8), (7, 9)], # Love
- 12: [(5, 4), (5, 6), (5, 7), (9, 4), (10, 5), (11, 4), (11, 5), (11, 6), (10, 6), (9, 6), (10, 7), (4, 11), (6, 11), (5, 10), (7, 13), (9, 10), (10, 10), (11, 10), (10, 11), (10, 12), (4, 12), (10, 13), (9, 5), (8, 5), (12, 5), (5, 5), (5, 13), (6, 13)], # I LOVE QT
- 13: [(4,6), (4,7), (4,8), (4,9), (4,10), (6,7), (6,8), (6,9), (7,6), (7,10), (8,6), (8,10), (10,6), (10,7), (10,8), (10,9), (10,10), (11,6), (11,8), (11,10), (12,6), (12,8), (12,10)], # ICE
- 14: [[7,8],[8,7],[8,8],[8,9],[9,8]], # 短十字架
- 15: [(6,6),(6,7),(6,9),(6,10),(7,6),(7,10),(9,6),(9,10),(10,6),(10,7),(10,9),(10,10)], # 小正方形框漏四个口
- 16: [(3,3),(3,13),(4,4),(4,12),(6,6),(6,10),(7,7),(7,9),(8,8),(9,7),(9,9),(10,6),(10,10),(12,4),(12,12),(13,3),(13,13)], # 斜交叉四宫格
- 17: [(4,5),(4,6),(4,10),(4,11),(5,4),(5,12),(6,4),(6,6),(6,10),(6,12),(7,7),(7,9),(12,5),(12,6),(12,10),(12,11),(11,4),(11,12),(10,4),(10,6),(10,10),(10,12),(9,7),(9,9)], # 四个锚
- 18: [(3,10),(4,9),(4,10),(5,8),(6,7),(6,10),(7,6),(7,10),(8,5),(8,10),(9,6),(9,10),(10,7),(10,10),(11,8),(12,9),(12,10),(13,10)], # △
- 19: [(3,7),(3,8),(3,9),(4,6),(4,10),(5,6),(6,6),(6,10),(7,7),(7,9),(8,8),(9,7),(9,9),(10,6),(10,10),(11,10),(12,6),(12,10),(13,7),(13,8),(13,9)], # ∞
- 20: [(5,5),(6,5),(7,5),(8,5),(9,5),(10,5),(11,5),(8,6),(8,7),(6,8),(7,8),(8,8),(9,8),(10,8),(8,9),(8,10),(5,11),(6,11),(7,11),(8,11),(9,11),(10,11),(11,11)], # 王
- 21: [(3,3),(4,4),(5,5),(5,6),(5,7),(6,4),(7,3),(7,6),(7,7),(7,8),(7,9),(7,10),(8,6),(8,8),(8,10),(9,6),(9,8),(9,10),(11,8),(11,9),(11,10),(11,12),(12,8),(12,10),(12,12),(13,8),(13,10),(13,11),(13,12)] # YES
- }
- def generalDistrictMapSpawn(n, alpha, beta, minDiff, minName, mon_dic, cell_type, besiege, wallNum, cubeNum):
- # 前几个参数和分区函数相同
- # besiege表示每个怪物被墙围住的概率%(0-100)
- # wallNum, cubeANum, cubeBNum为三种障碍物的最大上限数量(一般wallNum=5, 15<cubeNum<64)
- # wall为不可摧毁墙;
- monsters = []
- if random.randint(1, 100) >= 84:
- hole_type = random.randint(1, 21)
- coordinates = hole_type_map[hole_type].copy()
- obstacles = hole_type_map[hole_type].copy()
- wall = hole_type_map[hole_type].copy()
- wallNum = 0
- wall = setable(wall)
- coordinates = setable(coordinates)
- else:
- obstacles = []
- wall = []
- coordinates = []
- cube=[]
- Monsters = randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type)[0]
- if mon_dic == T.theme3_C_mon_dic: # 实验所特殊设置
- if "RogueLabAFireArtillery" not in Monsters and cell_type in ["elite","elite_normal"]:
- if len(Monsters) >= 4:
- Monsters.append("RogueLabAFireArtillery")
- elif mon_dic == T.theme_destiny_mon_dic: # 实验所特殊设置
- if len(Monsters) >= 4 and random.randint(1,100) >= 20:
- Monsters.append("RogueDestinyATimeStabilizer")
- if random.randint(1,100) >= 80:
- Monsters.append("RogueDestinyATimeStabilizer")
- if R.print_mode:
- print(Monsters)
- district=[]
- for i in range(len(Monsters)):
- x = random.randint(3, 13)
- y = random.randint(3, 13)
- if coordinates.count((x,y)) == 0:
- coordinates.append((x,y))
- monsters.append([x,y])
- district.append({"name": Monsters[i],"y": y,"x": x})
- else:
- a=x
- b=y
- while coordinates.count((a,b)) != 0:
- a = random.randint(3, 13)
- b = random.randint(3, 13)
- if coordinates.count((a,b)) == 0:
- coordinates.append((a,b))
- monsters.append([x,y])
- district.append({"name": Monsters[i],"y": b,"x": a})
- break
- for i in range(len(monsters)):
- isStop = random.randint(0, 100)
- x = monsters[i][0]
- y = monsters[i][1]
- if isStop >=100-besiege:
- if coordinates.count((x+1,y)) == 0:
- if obstacles.count([x+1,y]) == 0:
- obstacles.append([x+1,y])
- cube.append((x+1, y))
- coordinates.append((x+1,y))
- if coordinates.count((x-1,y)) == 0:
- if obstacles.count([x-1,y]) == 0:
- obstacles.append([x-1,y])
- cube.append((x-1, y))
- coordinates.append((x-1,y))
- if coordinates.count((x,y+1)) == 0:
- if obstacles.count([x,y+1]) == 0:
- obstacles.append([x,y+1])
- cube.append((x, y+1))
- coordinates.append((x,y+1))
- if coordinates.count((x,y-1)) == 0:
- if obstacles.count([x,y-1]) == 0:
- obstacles.append([x,y-1])
- cube.append((x, y-1))
- coordinates.append((x,y-1))
- while len(wall)<wallNum:
- x = random.randint(3, 13)
- y = random.randint(3, 13)
- if coordinates.count((x,y)) == 0:
- if obstacles.count([x,y]) == 0:
- obstacles.append((x,y))
- wall.append((x, y))
- coordinates.append((x,y))
- while len(cube)<cubeNum:
- x = random.randint(3, 13)
- y = random.randint(3, 13)
- if coordinates.count((x,y)) == 0:
- if obstacles.count([x,y]) == 0:
- obstacles.append([x,y])
- cube.append((x, y))
- coordinates.append((x,y))
- # print(wall, cube)
- # if len(set(wall).intersection(set(cube))) > 0:
- # print("有重复!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!:", set(wall).intersection(set(cube)))
- # import sys
- # sys.exit() # 中断代码执行
- return wall, cube, district
- # 子房到实际坐标xy映射
- def sub_cell_map(point_list, cell):
- if type(point_list) == list:
- result = []
- for point in point_list:
- result.append((point[0]+15*cell[0], point[1]+15*cell[1]))
- else:
- result = (point_list[0]+15*cell[0], point_list[1]+15*cell[1])
- return result
- # 实际坐标xy到子房映射
- def sub_cell_map_reverse(xy):
- return (int((xy[0]-2)/15), int((xy[1]-2)/15))
- def dynamic_cube_num(diff):
- return int(min(max(20, 0.6*diff), 45))
- def random_cell_generate(diff, monster_dic, cell_type, cell):
- diff = int(diff * min(1.6, max(0.7, random.normalvariate(1,1))))
- wall, cube, district = generalDistrictMapSpawn(diff, 0.7, 8, 5, list(monster_dic.keys())[0], monster_dic, cell_type, 80, 5, dynamic_cube_num(diff))
- for mon in district:
- new_xy = sub_cell_map((mon["x"], mon["y"]), cell)
- mon["x"] = new_xy[0]
- mon["y"] = new_xy[1]
- final_wall = sub_cell_map(wall, cell)
- final_cube = sub_cell_map(cube, cell)
- return final_wall, final_cube, district
- def generate_xy_symmetric_points(points):
- new_points = set() # 使用集合来自动去除重复的点
- max_coordinate = 16 # 假设最大坐标为16
- for x, y in points:
- # 计算x轴和y轴的对称点
- symmetric_point_x = (max_coordinate - x, y)
- symmetric_point_y = (x, max_coordinate - y)
- # 添加原始点和对称点到新集合中,集合自动处理重复值
- new_points.add((x, y))
- new_points.add(symmetric_point_x)
- new_points.add(symmetric_point_y)
- # 计算所有点的双轴对称点
- for x, y in list(new_points):
- symmetric_point_xy = (max_coordinate - x, max_coordinate - y)
- new_points.add(symmetric_point_xy)
- return list(new_points) # 将集合转换回列表
- # xy对称性区域
- def xy_SymmetricDistrictMapSpawn(n, alpha, beta, minDiff, minName, mon_dic, cell_type, besiege, wallNum, cubeNum, level_num):
- # 前几个参数和分区函数相同
- # besiege表示每个怪物被墙围住的概率%(0-100)
- # wallNum, cubeANum, cubeBNum为三种障碍物的最大上限数量(一般wallNum=5, 15<cubeNum<64)
- # wall为不可摧毁墙;
- monsters = []
- small_monsters = []
- obstacles=[]
- wall=[]
- coordinates=[]
- cube=[]
- district=[]
- if R.difficulty == "Easy":
- l_bound = 3
- elif R.difficulty == "Normal":
- l_bound = 2
- else:
- l_bound = 1
- sym_type = "corner"
- if random.randint(1,100)>=30:
- if random.randint(1,100)>=50:
- sym_type = "axis"
- else:
- sym_type = "centre"
- if sym_type == "corner":
- if R.difficulty == "Easy" and cell_type == "elite":
- cell_type = "normal_elite"
- if R.difficulty == "Easy" and (level_num - 1) % 5 + 1 <= 2:
- cell_type = "normal"
- Monsters = []
- smallMonsters = randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type, symmetric=True)[0]
- smallMonsters = smallMonsters[1:max(2,min(3,len(smallMonsters)+1))]
- elif sym_type == "axis":
- Monsters = [random.choice(randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type="elite", symmetric=True)[0])]
- if (level_num - 1) % 5 + 1 <= l_bound:
- smallMonsters = randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type="normal", symmetric=True)[0]
- else:
- if R.difficulty == "Easy" and cell_type == "elite":
- cell_type = "normal_elite"
- if R.difficulty == "Easy" and (level_num - 1) % 5 + 1 <= 2:
- cell_type = "normal"
- smallMonsters = randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type, symmetric=True)[0]
- if cell_type == "normal":
- smallMonsters = smallMonsters[1:max(2,min(3,len(smallMonsters)+1))]
- else:
- smallMonsters = [smallMonsters[0]]
- (x,y) = random.choice([(5,8),(6,8),(7,8),(7,8),(8,7),(8,7),(8,6),(8,5)])
- sym_points = generate_xy_symmetric_points([(x,y)])
- for point in sym_points:
- coordinates.append((point[0],point[1]))
- monsters.append([point[0],point[1]])
- district.append({"name": Monsters[0],"y": point[1],"x": point[0]})
- if coordinates.count((point[0]+1,point[1])) == 0:
- if obstacles.count([point[0]+1,point[1]]) == 0:
- obstacles.append([point[0]+1,point[1]])
- cube.append((point[0]+1,point[1]))
- coordinates.append((point[0]+1,point[1]))
- if coordinates.count((point[0]-1,point[1])) == 0:
- if obstacles.count([point[0]-1,point[1]]) == 0:
- obstacles.append([point[0]-1,point[1]])
- cube.append((point[0]-1,point[1]))
- coordinates.append((point[0]-1,point[1]))
- if coordinates.count((point[0],point[1]+1)) == 0:
- if obstacles.count([point[0],point[1]+1]) == 0:
- obstacles.append([point[0],point[1]+1])
- cube.append((point[0],point[1]+1))
- coordinates.append((point[0],point[1]+1))
- if coordinates.count((point[0],point[1]-1)) == 0:
- if obstacles.count([point[0],point[1]-1]) == 0:
- obstacles.append([point[0],point[1]-1])
- cube.append((point[0],point[1]-1))
- coordinates.append((point[0],point[1]-1))
- else:
- Monsters = [random.choice(randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type="elite", symmetric=True)[0])]
- if mon_dic == T.theme3_C_mon_dic: # 实验所特殊设置
- if "RogueLabAFireArtillery" not in Monsters and cell_type in ["elite","elite_normal"]:
- Monsters = ["RogueLabAFireArtillery"]
- if (level_num - 1) % 5 + 1 <= l_bound:
- smallMonsters = randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type="normal", symmetric=True)[0]
- else:
- if R.difficulty == "Easy" and cell_type == "elite":
- cell_type = "normal_elite"
- if R.difficulty == "Easy" and (level_num - 1) % 5 + 1 <= 2:
- cell_type = "normal"
- smallMonsters = randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type, symmetric=True)[0]
- if cell_type == "normal":
- smallMonsters = smallMonsters[0:max(2,min(3,len(smallMonsters)+1))-1]
- if R.difficulty == "Easy" and len(smallMonsters) > 0:
- smallMonsters = [smallMonsters[0]]
- else:
- smallMonsters = [smallMonsters[0]]
- coordinates.append((8,8))
- monsters.append([8,8])
- district.append({"name": Monsters[0],"y": 8,"x": 8})
- # print(sym_type, Monsters, smallMonsters)
- # print(cell_type, (level_num - 1) % 5 + 1, l_bound)
- for i in range(len(smallMonsters)):
- x = random.choice([5,6,6,7,7,7])
- y = random.choice([5,6,6,7,7,7])
- if coordinates.count((x,y)) == 0:
- coordinates.append((x,y))
- monsters.append([x,y])
- small_monsters.append([x,y])
- district.append({"name": smallMonsters[i],"y": y,"x": x})
- else:
- a=x
- b=y
- t = 0
- while coordinates.count((a,b)) != 0:
- t += 1
- if t >= 10000:
- break
- a = random.choice([5,6,6,7,7,7])
- b = random.choice([5,6,6,7,7,7])
- if coordinates.count((a,b)) == 0:
- coordinates.append((a,b))
- monsters.append([a,b])
- small_monsters.append([a,b])
- district.append({"name": smallMonsters[i],"y": b,"x": a})
- break
- for i in range(len(monsters)):
- isStop = random.randint(0, 100)
- x = monsters[i][0]
- y = monsters[i][1]
- if isStop >= 0:
- if coordinates.count((x+1,y)) == 0:
- if obstacles.count([x+1,y]) == 0:
- obstacles.append([x+1,y])
- cube.append((x+1, y))
- coordinates.append((x+1,y))
- if coordinates.count((x-1,y)) == 0:
- if obstacles.count([x-1,y]) == 0:
- obstacles.append([x-1,y])
- cube.append((x-1, y))
- coordinates.append((x-1,y))
- if coordinates.count((x,y+1)) == 0:
- if obstacles.count([x,y+1]) == 0:
- obstacles.append([x,y+1])
- cube.append((x, y+1))
- coordinates.append((x,y+1))
- if coordinates.count((x,y-1)) == 0:
- if obstacles.count([x,y-1]) == 0:
- obstacles.append([x,y-1])
- cube.append((x, y-1))
- coordinates.append((x,y-1))
- while len(wall)<int(wallNum/3):
- x = random.randint(3, 8)
- y = random.randint(3, 8)
- if coordinates.count((x,y)) == 0:
- if obstacles.count([x,y]) == 0:
- obstacles.append([x,y])
- wall.append((x, y))
- coordinates.append((x,y))
- while len(cube)<int(cubeNum/3):
- x = random.randint(3, 8)
- y = random.randint(3, 8)
- if coordinates.count((x,y)) == 0:
- if obstacles.count([x,y]) == 0:
- obstacles.append([x,y])
- cube.append((x, y))
- coordinates.append((x,y))
- res_cube = generate_xy_symmetric_points(cube)
- res_wall = generate_xy_symmetric_points(wall)
- for monster in district:
- for p in generate_xy_symmetric_points([(monster["x"],monster["y"])]):
- if {"name": monster["name"],"y": p[1],"x": p[0]} not in district and (p[0],p[1]) not in coordinates:
- coordinates.append((p[0],p[1]))
- district.append({"name": monster["name"],"y": p[1],"x": p[0]})
- return res_wall, res_cube, district
- def xy_symmetric_cell_generate(diff, monster_dic, cell_type, cell, level_num):
- diff = int(diff * min([2, max(0.7, random.normalvariate(1,1))]))
- wall, cube, district = xy_SymmetricDistrictMapSpawn(diff, 0.7, 8, 5, list(monster_dic.keys())[0], monster_dic, cell_type, 80, 5, dynamic_cube_num(diff), level_num)
- for mon in district:
- new_xy = sub_cell_map((mon["x"], mon["y"]), cell)
- mon["x"] = new_xy[0]
- mon["y"] = new_xy[1]
- final_wall = sub_cell_map(wall, cell)
- final_cube = sub_cell_map(cube, cell)
- return final_wall, final_cube, district
- def generate_rotated_points(points):
- new_points = set() # 使用集合来自动去除重复的点
- cx, cy = 8, 8 # 旋转中心
- for x, y in points:
- # 原始点
- new_points.add((x, y))
- # 90度旋转
- x_90 = cy - (y - cy)
- y_90 = (x - cx) + cy
- new_points.add((x_90, y_90))
- # 180度旋转
- x_180 = cx - (x - cx)
- y_180 = cy - (y - cy)
- new_points.add((x_180, y_180))
- # 270度旋转
- x_270 = (y - cy) + cx
- y_270 = cy - (x - cx)
- new_points.add((x_270, y_270))
- return list(new_points) # 将集合转换回列表
- # 旋转对称区域
- def rotationalSymmetricDistrictMapSpawn(n, alpha, beta, minDiff, minName, mon_dic, cell_type, besiege, wallNum, cubeNum, level_num):
- # 前几个参数和分区函数相同
- # besiege表示每个怪物被墙围住的概率%(0-100)
- # wallNum, cubeANum, cubeBNum为三种障碍物的最大上限数量(一般wallNum=5, 15<cubeNum<64)
- # wall为不可摧毁墙;
- monsters = []
- small_monsters = []
- obstacles=[]
- wall=[]
- coordinates=[]
- cube=[]
- district=[]
- if R.difficulty == "Easy":
- l_bound = 3
- elif R.difficulty == "Normal":
- l_bound = 2
- else:
- l_bound = 1
- sym_type = "corner"
- if random.randint(1,100)>=50:
- sym_type = "centre"
- if sym_type == "corner":
- if R.difficulty == "Easy" and cell_type == "elite":
- cell_type = "normal_elite"
- if R.difficulty == "Easy" and (level_num - 1) % 5 + 1 <= 2:
- cell_type = "normal"
- Monsters = []
- smallMonsters = [random.choice(randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type, symmetric=True)[0])] + [random.choice(randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, "normal", symmetric=True)[0])]
- else:
- Monsters = [random.choice(randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type="elite", symmetric=True)[0])]
- if (level_num - 1) % 5 + 1 <= l_bound:
- smallMonsters = [random.choice(randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type="normal", symmetric=True)[0])] + random.randint(0,1) * [random.choice(randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type="normal", symmetric=True)[0])]
- else:
- if R.difficulty == "Easy" and cell_type == "elite":
- cell_type = "normal_elite"
- if R.difficulty == "Easy" and (level_num - 1) % 5 + 1 <= 2:
- cell_type = "normal"
- smallMonsters = [random.choice(randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type=cell_type, symmetric=True)[0])] + random.randint(0,1) * [random.choice(randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type="normal", symmetric=True)[0])]
- coordinates.append((8,8))
- monsters.append([8,8])
- district.append({"name": Monsters[0],"y": 8,"x": 8})
- if R.print_mode:
- print(sym_type, Monsters, smallMonsters)
- print(cell_type, (level_num - 1) % 5 + 1, l_bound)
- for i in range(len(smallMonsters)):
- x = random.choice([5,6,6,7,7,7])
- y = random.choice([5,6,6,7,7,7])
- if coordinates.count((x,y)) == 0:
- coordinates.append((x,y))
- monsters.append([x,y])
- small_monsters.append([x,y])
- district.append({"name": smallMonsters[i],"y": y,"x": x})
- else:
- a=x
- b=y
- t = 0
- while coordinates.count((a,b)) != 0:
- t += 1
- if t >= 10000:
- break
- a = random.choice([5,6,6,7,7,7])
- b = random.choice([5,6,6,7,7,7])
- if coordinates.count((a,b)) == 0:
- coordinates.append((a,b))
- monsters.append([a,b])
- small_monsters.append([a,b])
- district.append({"name": smallMonsters[i],"y": b,"x": a})
- break
- for i in range(len(monsters)):
- isStop = random.randint(0, 100)
- x = monsters[i][0]
- y = monsters[i][1]
- if isStop >= 0:
- if coordinates.count((x+1,y)) == 0:
- if obstacles.count([x+1,y]) == 0:
- obstacles.append([x+1,y])
- cube.append((x+1, y))
- coordinates.append((x+1,y))
- if coordinates.count((x-1,y)) == 0:
- if obstacles.count([x-1,y]) == 0:
- obstacles.append([x-1,y])
- cube.append((x-1, y))
- coordinates.append((x-1,y))
- if coordinates.count((x,y+1)) == 0:
- if obstacles.count([x,y+1]) == 0:
- obstacles.append([x,y+1])
- cube.append((x, y+1))
- coordinates.append((x,y+1))
- if coordinates.count((x,y-1)) == 0:
- if obstacles.count([x,y-1]) == 0:
- obstacles.append([x,y-1])
- cube.append((x, y-1))
- coordinates.append((x,y-1))
- while len(wall)<int(wallNum/3):
- x = random.randint(3, 8)
- y = random.randint(3, 8)
- if coordinates.count((x,y)) == 0:
- if obstacles.count([x,y]) == 0:
- obstacles.append([x,y])
- wall.append((x, y))
- coordinates.append((x,y))
- while len(cube)<int(cubeNum/3):
- x = random.randint(3, 8)
- y = random.randint(3, 8)
- if coordinates.count((x,y)) == 0:
- if obstacles.count([x,y]) == 0:
- obstacles.append([x,y])
- cube.append((x, y))
- coordinates.append((x,y))
- res_cube = generate_rotated_points(cube)
- res_wall = generate_rotated_points(wall)
- res_wall = list(set(res_wall) - set(res_cube))
- for monster in district:
- for p in generate_rotated_points([(monster["x"],monster["y"])]):
- if {"name": monster["name"],"y": p[1],"x": p[0]} not in district and (p[0],p[1]) not in coordinates:
- coordinates.append((p[0],p[1]))
- district.append({"name": monster["name"],"y": p[1],"x": p[0]})
- return res_wall, res_cube, district
- def rotationalSymmetric_cell_generate(diff, monster_dic, cell_type, cell, level_num):
- diff = int(diff * min([2, max(0.7, random.normalvariate(1,1))]))
- wall, cube, district = rotationalSymmetricDistrictMapSpawn(diff, 0.7, 8, 5, list(monster_dic.keys())[0], monster_dic, cell_type, 80, 5, dynamic_cube_num(diff), level_num)
- for mon in district:
- new_xy = sub_cell_map((mon["x"], mon["y"]), cell)
- mon["x"] = new_xy[0]
- mon["y"] = new_xy[1]
- final_wall = sub_cell_map(wall, cell)
- final_cube = sub_cell_map(cube, cell)
- return final_wall, final_cube, district
- def bossDistrictMapSpawn(n, alpha, beta, minDiff, minName, mon_dic, cell_type, besiege, wallNum, cubeNum):
- # 前几个参数和分区函数相同
- # besiege表示每个怪物被墙围住的概率%(0-100)
- # wallNum, cubeANum, cubeBNum为三种障碍物的最大上限数量(一般wallNum=5, 15<cubeNum<64)
- # wall为不可摧毁墙;
- monsters = []
- cell_type = random.choice(["single_boss","mix_boss"])
- if random.randint(1, 100) >= 95:
- hole_type = random.randint(1,5)
- if hole_type == 1:
- coordinates = [[7,7],[7,8],[7,9],[8,7],[8,8],[8,9],[9,7],[9,8],[9,9]]
- obstacles=[[7,7],[7,8],[7,9],[8,7],[8,8],[8,9],[9,7],[9,8],[9,9]]
- wall=[[7,7],[7,8],[7,9],[8,7],[8,8],[8,9],[9,7],[9,8],[9,9]]
- wallNum = 0
- elif hole_type == 2:
- coordinates = [[7,7],[7,8],[7,9],[8,7],[8,8],[8,9],[9,7],[9,8],[9,9],[6,8],[8,6],[8,10],[10,8]]
- obstacles=[[7,7],[7,8],[7,9],[8,7],[8,8],[8,9],[9,7],[9,8],[9,9],[6,8],[8,6],[8,10],[10,8]]
- wall=[[7,7],[7,8],[7,9],[8,7],[8,8],[8,9],[9,7],[9,8],[9,9],[6,8],[8,6],[8,10],[10,8]]
- wallNum = 0
- elif hole_type == 3:
- coordinates = [[6,7],[7,6],[7,7], [9,6],[9,7],[10,7], [6,9],[7,9],[7,10], [9,9],[9,10],[10,9]]
- obstacles = [[6,7],[7,6],[7,7], [9,6],[9,7],[10,7], [6,9],[7,9],[7,10], [9,9],[9,10],[10,9]]
- wall = [[6,7],[7,6],[7,7], [9,6],[9,7],[10,7], [6,9],[7,9],[7,10], [9,9],[9,10],[10,9]]
- wallNum = 0
- elif hole_type == 4:
- coordinates = [[5,7],[5,9],[6,6],[6,10],[7,5],[7,11],[11,7],[11,9],[10,6],[10,10],[9,5],[9,11]]
- obstacles = [[5,7],[5,9],[6,6],[6,10],[7,5],[7,11],[11,7],[11,9],[10,6],[10,10],[9,5],[9,11]]
- wall = [[5,7],[5,9],[6,6],[6,10],[7,5],[7,11],[11,7],[11,9],[10,6],[10,10],[9,5],[9,11]]
- wallNum = 0
- else:
- coordinates = [[7,8],[8,7],[8,8],[8,9],[9,8]]
- obstacles=[[7,8],[8,7],[8,8],[8,9],[9,8]]
- wall=[[7,8],[8,7],[8,8],[8,9],[9,8]]
- wallNum = 0
- coordinates = setable(coordinates)
- else:
- obstacles=[]
- wall=[]
- coordinates=[]
- cube=[]
- Monsters = randomDistrictAllocation(n, alpha, beta, minDiff, minName, mon_dic, cell_type)[0]
- boss_num = 0
- for m in Monsters:
- if m in T.boss_list:
- boss_num += 1
- if boss_num >= 3:
- Monsters.remove(m)
- if R.print_mode:
- print(Monsters)
- district=[]
- for i in range(len(Monsters)):
- x = random.randint(3, 13)
- y = random.randint(3, 13)
- if coordinates.count((x,y)) == 0:
- coordinates.append((x,y))
- monsters.append([x,y])
- district.append({"name": Monsters[i],"y": y,"x": x})
- else:
- a=x
- b=y
- while coordinates.count((a,b)) != 0:
- a = random.randint(3, 13)
- b = random.randint(3, 13)
- if coordinates.count((a,b)) == 0:
- coordinates.append((a,b))
- monsters.append([x,y])
- district.append({"name": Monsters[i],"y": b,"x": a})
- break
- for i in range(len(monsters)):
- isStop = random.randint(0, 100)
- x = monsters[i][0]
- y = monsters[i][1]
- if isStop >=100-besiege:
- if coordinates.count((x+1,y)) == 0:
- if obstacles.count((x+1,y)) == 0:
- obstacles.append([x+1,y])
- cube.append((x+1, y))
- coordinates.append((x+1,y))
- if coordinates.count((x-1,y)) == 0:
- if obstacles.count([x-1,y]) == 0:
- obstacles.append([x-1,y])
- cube.append((x-1, y))
- coordinates.append((x-1,y))
- if coordinates.count((x,y+1)) == 0:
- if obstacles.count([x,y+1]) == 0:
- obstacles.append([x,y+1])
- cube.append((x, y+1))
- coordinates.append((x,y+1))
- if coordinates.count((x,y-1)) == 0:
- if obstacles.count([x,y-1]) == 0:
- obstacles.append([x,y-1])
- cube.append((x, y-1))
- coordinates.append((x,y-1))
- while len(wall)<wallNum:
- x = random.randint(3, 13)
- y = random.randint(3, 13)
- if coordinates.count((x,y)) == 0:
- if obstacles.count([x,y]) == 0:
- obstacles.append([x,y])
- wall.append((x, y))
- coordinates.append((x,y))
- while len(cube)<cubeNum:
- x = random.randint(3, 13)
- y = random.randint(3, 13)
- if coordinates.count((x,y)) == 0:
- if obstacles.count([x,y]) == 0:
- obstacles.append([x,y])
- cube.append((x, y))
- coordinates.append((x,y))
- return wall, cube, district
- def boss_cell_generate(diff, monster_dic, cell_type, cell):
- diff = int(diff * min(1.6, max(0.8, random.normalvariate(1,1))))
- wall, cube, district = bossDistrictMapSpawn(diff, 0.7, 8, 5, list(monster_dic.keys())[0], monster_dic, cell_type, 80, 5, dynamic_cube_num(diff))
- for mon in district:
- new_xy = sub_cell_map((mon["x"], mon["y"]), cell)
- mon["x"] = new_xy[0]
- mon["y"] = new_xy[1]
- final_wall = sub_cell_map(wall, cell)
- final_cube = sub_cell_map(cube, cell)
- return final_wall, final_cube, district
- # 修行区
- def exercise_cell_generate(cell):
- wall = [(3,3),(3,4),(3,12),(3,13),(4,3),(4,6),(4,7),(4,9),(4,10),(4,13),(5,7),(5,8),(5,9),(6,4),(6,12),(7,4),(7,5),(7,7),(7,9),(7,11),(7,12),(9,4),(9,5),(9,7),(9,9),(9,11),(9,12),(10,4),(10,12),(11,7),(11,8),(11,9),(12,3),(12,6),(12,7),(12,9),(12,10),(12,13),(13,3),(13,4),(13,12),(13,13)]
- cube = [(7,6),(7,10),(8,5),(8,7),(8,9),(8,11),(9,6),(9,10)]
- district = [{"name": "RougeExerciseController","y": 8,"x": 8}]
- for mon in district:
- new_xy = sub_cell_map((mon["x"], mon["y"]), cell)
- mon["x"] = new_xy[0]
- mon["y"] = new_xy[1]
- final_wall = sub_cell_map(wall, cell)
- final_cube = sub_cell_map(cube, cell)
- return final_wall, final_cube, district
- # 商店区
- def shop_cell_generate(cell, shop_level=1, level_num=1):
- # wall = [(5,5),(4,5),(3,5),(3,6),(3,7),(3,8),(3,9), (4,9), (5,6),(5,7),(5,9),(5,11),(5,12),(5,13), (6,5),(6,6),(6,7),(6,13), (7,5),(7,9),(7,10),(7,11),(7,13), (8,4),(8,5),(8,6),(8,7),(8,9),(8,13), (9,4),(9,9),(9,10),(9,11),(9,13), (10,4),(10,5),(10,6),(10,7),(10,13), (11,5),(11,9),(11,11),(11,12),(11,13), (12,5),(12,6),(12,7),(12,8),(12,9)]
- # sell_coordinate = [(5,5),(11,5),(5,11),(11,11)]
- # district = [{"name": "RougeShopQuit","y": 10,"x": 8}]
- wall = [(12, 5), (12, 6), (4, 5), (4, 10), (4, 11), (6, 12), (7, 12), (10, 12), (11, 12), (12, 12), (12, 11), (12, 10), (12, 9), (12, 4), (11, 4), (4, 6), (4, 7), (10, 4), (4, 12), (5, 12), (6, 5), (5, 10), (10, 11), (6, 7), (6, 6), (10, 6), (10, 10), (8, 4), (8, 5), (10, 7), (8, 7), (6, 8), (4, 8), (10, 5), (12, 7), (7, 10), (6, 10), (10, 9), (8, 12), (8, 6), (5, 5), (7, 4), (6, 4), (8, 10), (8, 8), (4, 4), (5, 4)]
- sell_coordinate = [(5,6),(11,5),(5,11),(11,11)]
- district = [{"name": "RougeShopQuit","y": 5,"x": 7}]
- seller_1 = ["RougeShopHP100", "RougeShopDMG100", "RougeSmallHPRecoveryPotion", "RougeSmallHPRecoveryPotion", "RougeSmallHPRecoveryPotion", "RougeShopMonsterDefenseN200", "RougeShopMonsterHPN4", "RougeShopHPReviveCard", "RougeShopFlameSelfDMGN20"]
- seller_2 = ["RougeShopHP100", "RougeShopHP200", "RougeShopDMG100", "RougeShopDMG200", "RougeSmallHPRecoveryPotion", "RougeSmallHPRecoveryPotion", "RougeSmallHPRecoveryPotionMiddle", "RougeSmallHPRecoveryPotionMiddle", "RougeShopMonsterDefenseN200", "RougeShopMonsterDefenseN400", "RougeShopMonsterHPN4", "RougeShopMonsterHPN8", "RougeShopHPReviveCard", "RougeShopHPReviveCard", "RougeShopFlameSelfDMGN20", "RougeShopFlameSelfDMGN40", "RougeShopSwitchHPDMG", "RougeShopSlowImmune", "RougeShopReverseImmune", "RougeShopRootImmune", "RougeShopStunImmune", "RougeShopDestination"]
- seller_3 = ["RougeShopHP100", "RougeShopHP200", "RougeShopHP300", "RougeShopDMG100", "RougeShopDMG200", "RougeShopDMG300", "RougeSmallHPRecoveryPotion", "RougeSmallHPRecoveryPotion", "RougeSmallHPRecoveryPotionMiddle", "RougeSmallHPRecoveryPotionMiddle", "RougeSmallHPRecoveryPotionBig", "RougeSmallHPRecoveryPotionBig", "RougeSmallHPRecoveryPotionBig", "RougeShopMonsterDefenseN200", "RougeShopMonsterDefenseN400", "RougeShopMonsterDefenseN800", "RougeShopMonsterHPN4", "RougeShopMonsterHPN8", "RougeShopMonsterHPN16", "RougeShopHPReviveCard", "RougeShopHPReviveCard", "RougeShopHPReviveCard", "RougeShopFlameSelfDMGN20", "RougeShopFlameSelfDMGN40", "RougeShopFlameSelfDMGN60", "RougeShopSwitchHPDMG", "RougeShopSlowImmune", "RougeShopReverseImmune", "RougeShopRootImmune", "RougeShopStunImmune"] + \
- ["RougeShopDestination"]
- seller_4 = ["RougeShopHP300", "RougeShopDMG300", "RougeSmallHPRecoveryPotionBig", "RougeShopMonsterHPN16", "RougeShopHPReviveCard", "RougeShopFlameSelfDMGN60", "RougeShopSwitchHPDMG", "RougeShopSlowImmune", "RougeShopReverseImmune", "RougeShopRootImmune", "RougeShopStunImmune", "RougeShopDestination"]
- seller_5 = seller_4 # 巫术商店(用血量来买伤害/道具/金币)
- sell_num = random.randint(3,4)
- if shop_level==3:
- if random.randint(1,100)>=90:
- shop_level = 4
- sell_num = random.randint(3,4)
- if shop_level<=3:
- if random.randint(1,100)>=95:
- shop_level = 5
- sell_num = 4
- for i in range(sell_num):
- if shop_level==1:
- s = random.choice(seller_1)
- elif shop_level==2:
- s = random.choice(seller_2)
- elif shop_level==3:
- s = random.choice(seller_3)
- elif shop_level==4:
- s = random.choice(seller_4)
- else:
- s = random.choice(seller_5)
- if i == 0 and not R.has_ocean_shop:
- if R.pass_status[R.difficulty] >= 1 and level_num >= 8 and not R.story_ocean:
- R.has_ocean_shop = True
- s = "RougeStoryOcean"
- if R.print_mode:
- print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
- print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
- print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
- print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
- print("yes!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", level_num)
- # Test
- # s = "RougeShopReverseImmune"
- xy = sell_coordinate[i]
- district.append({"name": s, "y": xy[1], "x": xy[0]})
- for mon in district:
- new_xy = sub_cell_map((mon["x"], mon["y"]), cell)
- mon["x"] = new_xy[0]
- mon["y"] = new_xy[1]
- final_wall = sub_cell_map(wall, cell)
- return final_wall, district
- # 祈运区
- def treasure_cell_generate(cell, shop_level=1):
- wall1 = [(5,5),(5,6),(6,5),(6,8),(6,9),(7,9),(7,10),(8,6),(8,10),(9,6),(9,7),(10,7),(10,8),(10,11),(11,10),(11,11)]
- wall2 = [(10, 7), (10, 9), (6, 9), (6, 7), (7, 6), (9, 6), (9, 10), (7, 10), (9, 5), (8, 4), (7, 11), (8, 12), (11, 9), (12, 8), (5, 7), (4, 8), (9, 12), (4, 9), (12, 7), (7, 4)]
- wall3 = [(5, 6), (6, 5), (10, 11), (2, 6), (6, 2), (11, 10), (14, 10), (10, 14), (6, 9), (7, 10), (7, 11), (5, 9), (7, 9), (9, 5), (9, 6), (9, 7), (10, 7), (11, 7), (3, 12), (3, 13), (4, 13), (12, 3), (13, 3), (13, 4), (10, 12), (12, 10), (4, 6), (6, 4), (10, 10), (6, 6), (7, 7), (9, 9), (9, 10), (7, 6), (8, 12), (7, 12), (9, 4), (8, 4), (12, 7), (12, 8), (4, 8), (4, 9)]
- wall = random.choice([wall1, wall2, wall3])
- cube = [(4,10),(4,11),(4,12),(5,10),(5,12),(6,10),(6,11),(6,12), (10,4),(10,5),(10,6),(11,4),(11,6),(12,4),(12,5),(12,6)]
- district = [{"name": "RougeTreasureController","y": 8,"x": 8}]
- for mon in district:
- new_xy = sub_cell_map((mon["x"], mon["y"]), cell)
- mon["x"] = new_xy[0]
- mon["y"] = new_xy[1]
- final_wall = sub_cell_map(wall, cell)
- final_cube = sub_cell_map(cube, cell)
- return final_wall, final_cube, district
- # 擂台区
- def combat_decision(cell, level_num):
- wall = [(4,12),(12,4), (10, 4), (11, 4), (12, 5), (12, 6), (5, 9), (4, 10), (4, 11), (5, 12), (6, 12), (11, 7), (9, 5), (7, 11), (8, 7), (8, 9), (7, 10), (9, 6), (5, 3), (3, 5), (4, 4), (5, 5), (11, 13), (13, 11), (11, 11), (12, 12)]
- cube = [(4, 3), (3, 4), (6, 4), (6, 5), (5, 6), (4, 6), (8, 8), (12, 10), (11, 10), (10, 11), (10, 12), (12, 13), (13, 12)]
- district = [{"name": "RougeCombatAccept","y": 5,"x": 11},{"name": "RougeCombatRun","y": 11,"x": 5}]
- # print(R.pass_status[R.difficulty], level_num, R.story_eden, R.story_destiny)
- if R.pass_status[R.difficulty] >= 1 and level_num == 10 and not R.story_eden and not R.story_destiny:
- # print("comem on!")
- R.story_eden = True
- district = [{"name": "RougeStoryEden","y": 5,"x": 11},{"name": "RougeStoryRun","y": 11,"x": 5}]
- # 坐标映射
- for mon in district:
- new_xy = sub_cell_map((mon["x"], mon["y"]), cell)
- mon["x"] = new_xy[0]
- mon["y"] = new_xy[1]
- final_wall = sub_cell_map(wall, cell)
- final_cube = sub_cell_map(cube, cell)
- return final_wall, final_cube, district
- # 赌场
- def casino(cell):
- wall = [(4, 4), (5, 4), (4, 5), (4, 6), (4, 7), (6, 7), (6, 6), (7, 6), (11, 4), (12, 4), (12, 5), (12, 6), (12, 7), (9, 6), (10, 6), (10, 7), (12, 9), (12, 10), (12, 11), (12, 12), (11, 12), (10, 12), (9, 12), (10, 9), (10, 10), (9, 10), (6, 9), (6, 10), (7, 10), (4, 9), (4, 10), (4, 11), (4, 12), (5, 12), (6, 12), (7, 12), (6, 4), (10, 4), (9, 4), (7, 4), (7, 7), (7, 9), (9, 7), (9, 9)]
- cube = [(8, 7), (7, 8), (9, 8), (8, 9)]
- district = [{"name": "RougeCasinoGamble20P","y": 5,"x": 11},{"name": "RougeCasinoRun","y": 8,"x": 8}]
- # 坐标映射
- for mon in district:
- new_xy = sub_cell_map((mon["x"], mon["y"]), cell)
- mon["x"] = new_xy[0]
- mon["y"] = new_xy[1]
- final_wall = sub_cell_map(wall, cell)
- final_cube = sub_cell_map(cube, cell)
- return final_wall, final_cube, district
|