Files
CreateE_SpaceCCL/CFAB.py
2026-01-26 09:47:48 +08:00

232 lines
13 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import Mil
import random
import time
import os
from threading import Thread
def asyncs(f):
def wrapper(*args, **kwargs):
thr = Thread(target = f, args = args, kwargs = kwargs)
thr.start()
return wrapper
#Command the fantastic adventure of the block
# 186 64 -216
# 188 64 -173
# 212 64 -216
# 228 64 -188
# 247 64 -229
summon_pos=[
Mil.Milib.RelativePos(186, 64, -216),
Mil.Milib.RelativePos(188, 64, -173),
Mil.Milib.RelativePos(228, 64, -188),
Mil.Milib.RelativePos(247, 64, -229),
Mil.Milib.RelativePos(212, 64, -216)
]
# NV_NUMBER = 1000
GC_NUMBER = 5000
COMMAND_BLOCK_POS=Mil.Milib.RelativePos(208, 108, -204)
ADAS=["@a"]
class _CFAB(Mil.MCROCN):
def __init__(self, host, password, port, debug=True):
super().__init__(host, password, port, debug=debug)
def Start(self):
self.StartStory()
self.StartDraw()
c=Mil.Milib._Pos1ToPos2DrawPi(Mil.Milib.RelativePos(195, 108, -204), Mil.Milib.RelativePos(188, 108 -204), 100)
for i in c:
self.Particle("minecraft:end_rod", i, Mil.Milib.Delta(), 0.2, 30, "force", "@a")
#CFAB.Bossbar("add", "minecraft:100", '[{"text":"==","color":"red"},{"text":"====","obfuscated":true,"color":"red"},{"text":"==","color":"red"},{{"text":"1000","color":"red"},{"text":" \u5973\u5deb","color":"dark_red"},{"text":"\u5927\u8d5b","color":"dark_green"},{"text":" \u751f\u6210","color":"gold"},{"text":"\u8fdb\u5ea6","color":"green"},{"text":" ==","color":"red"},{"text":"====","obfuscated":true,"color":"red"},{"text":"==","color":"red"}]')
#CFAB.Bossbar("set", "minecraft:100", "color", "red")
#CFAB.Bossbar("set", "minecraft:100", "max", "1000")
#CFAB.Bossbar("set", "minecraft:100", "style", "notched_20")
#CFAB.Bossbar("set", "minecraft:100", "players", "@a")
#CFAB.Bossbar("set", "minecraft:100", "visible", "true")
#s=Mil.Milib._Pos1ToPos2()
def StartDraw(self):
r=Mil.Milib._Pos1ToPos2(summon_pos[0], COMMAND_BLOCK_POS, 15)
r2=Mil.Milib._Pos1ToPos2(summon_pos[1], COMMAND_BLOCK_POS, 15)
r3=Mil.Milib._Pos1ToPos2(summon_pos[2], COMMAND_BLOCK_POS, 15)
r4=Mil.Milib._Pos1ToPos2(summon_pos[3], COMMAND_BLOCK_POS, 15)
r5=Mil.Milib._Pos1ToPos2(summon_pos[4], COMMAND_BLOCK_POS, 15)
merged = []
for q,w,e,r,t,y in zip(r, r2, r3, r4, r5,[COMMAND_BLOCK_POS]*15):
merged.extend([q,w,e,r,t,y])
for s in range(5):
if s != 0:
self._RunCommand(f"summon minecraft:lightning_bolt {summon_pos[0]}")
self._RunCommand(f"summon minecraft:lightning_bolt {summon_pos[1]}")
self._RunCommand(f"summon minecraft:lightning_bolt {summon_pos[2]}")
self._RunCommand(f"summon minecraft:lightning_bolt {summon_pos[3]}")
self._RunCommand(f"summon minecraft:lightning_bolt {summon_pos[4]}")
self.Particle("minecraft:entity_effect", summon_pos[0], Mil.Milib.Delta(5, 0 ,5), 1, 10000, "force", "@a")
_=0
for _i, i in zip(range(len(merged)), merged):
if _i < 5 and s != 0:
self.PlaySoundWith("minecraft:item.totem.use", ADAS)
self.Particle("minecraft:totem_of_undying", i, Mil.Milib.Delta(), 0.7, 1000, "force", "@a")
if i == COMMAND_BLOCK_POS:
self.Particle("minecraft:totem_of_undying", i, Mil.Milib.Delta(), 2, 1000, "force", "@a")
continue
#if _i % 10 == 0: self.PlaySoundWith("minecraft:block.anvil.use", ADAS)
self.Particle("minecraft:end_rod", i, Mil.Milib.Delta(), 0.2, 30, "force", "@a")
for i in range(5):
self._RunCommand(f"summon minecraft:lightning_bolt {COMMAND_BLOCK_POS}")
self.PlaySoundWith("block.end_portal_frame.fill", ADAS)
self.PlaySoundWith("block.end_portal_frame.fill", ADAS)
self.PlaySoundWith("block.end_portal_frame.fill", ADAS)
self.PlaySoundWith("block.end_portal_frame.fill", ADAS)
self.PlaySoundWith("block.end_portal_frame.fill", ADAS)
time.sleep(0.5)
self.PlaySoundWith("minecraft:entity.elder_guardian.curse", ADAS)
for _ in range(5):
for i in summon_pos:
self._RunCommand(f"summon minecraft:lightning_bolt {i}")
for i in range(5):
self._RunCommand(f"summon minecraft:lightning_bolt {COMMAND_BLOCK_POS}")
self.PlaySoundWith("minecraft:item.totem.use", ADAS)
self.Particle("minecraft:totem_of_undying", COMMAND_BLOCK_POS, Mil.Milib.Delta(), 2, 1000, "force", "@a")
self.PlaySoundWith("minecraft:entity.elder_guardian.curse", ADAS)
time.sleep(1)
self.Particle("minecraft:explosion", COMMAND_BLOCK_POS, Mil.Milib.Delta(10, 10, 10), 1, 100, "force", "@a")
time.sleep(1)
for i in range(5):
self.PlaySoundWith("minecraft:entity.wither.spawn", ADAS)
time.sleep(1)
self.Particle("minecraft:totem_of_undying", COMMAND_BLOCK_POS, Mil.Milib.Delta(), 2, 1000, "force", "@a")
self.PlaySoundWith("minecraft:item.totem.use", ADAS)
time.sleep(1)
self._RunCommand(f"summon minecraft:lightning_bolt {COMMAND_BLOCK_POS}")
self.Particle("minecraft:totem_of_undying", COMMAND_BLOCK_POS, Mil.Milib.Delta(), 2, 1000, "force", "@a")
time.sleep(0.5)
self.Particle("minecraft:nautilus", COMMAND_BLOCK_POS, Mil.Milib.Delta(2, 2, 2), 2, 10000, "force", "@a")
def StartStory(self):
self.TellRawAll({"text": "古老的传说在方块世界深处回响...", "color": "green"});time.sleep(5)
self.TellRawAll([{"text": "那是一个由", "color": "green"},
{"text": " 纯粹指令之力 ","color":"yellow"},
{"text": "构筑的领域。", "color": "green"},
{"text": " RCON ", "color": "red"},
{"text": "", "color": "green"},
{"text": " MCOMMAND ", "color": "red"},
{"text": "化为", "color": "green"},
{"text": "黑紫色", "color": "black"},
{"text": "", "color": "green"},
{"text": "混沌", "color": "black"},
{"text": "交织", "color": "red"}]);time.sleep(5)
self.TellRawAll([{"text": "一个", "color": "green"},
{"text": "年近古稀的老人", "color": "yellow"},
{"text": "翻开了老旧的书页,为他的重孙子念起故事,", "color": "green"}]);time.sleep(5)
self.TellRawAll([{"text": "沉寂的文字", "color": "black"},
{"text": "", "color": "green"},
{"text": "空中", "color": "blue"},
{"text": "回想", "color": "yellow"},
{"text": ",仿佛将老人又带回那天...", "color": "green"}]);time.sleep(5)
self.TellRawAll([{"text": "三十年前,", "color": "green"},
{"text": "命令方块", "color": "orange"},
{"text": "失控的夜晚,", "color": "green"},
{"text": "紫黑色", "color": "black"},
{"text": "", "color": "green"},
{"text": "代码", "color": "green"},
{"text": "洪流吞没了村庄。", "color": "black"}]);time.sleep(5)
self.TellRawAll([{"text": "他亲眼看见妻子的围裙被数据乱流撕成粉末,儿子的铁剑在抵挡", "color": "green"},
{"text": "凋灵风暴", "color": "black"},
{"text": "时断成两截。"}]);time.sleep(5)
self.TellRawAll([{"text": "最后只有他抱着尚在襁褓的孙子,蜷缩在", "color": "green"},
{"text": "基岩裂缝", "color": "black"},
{"text": "里熬到黎明。", "color": "green"}]);time.sleep(5)
self.TellRawAll([{"text": "屋外刮起一阵风声,老人突然冲出门去,看着天上", "color": "green"},
{"text": "紫黑色的暗影。", "color": "black"}]);time.sleep(5)
self.TellRawAll([{"text": "他开始呢喃着难道是它又回来了TERVIRUSCommand_BlockMCRCON还没结束吗", "color": "red"}]);time.sleep(10)
self.TellRawAll([{"text": "勇敢的冒险者啊……你脚下", "color": "green"},
{"text": "圣洁的土地", "color": "white"},
{"text": "已被", "color": "green"},
{"text": "混沌", "color": "block"},
{"text": "侵蚀。", "color": "red"}]);time.sleep(5)
self.TellRawAll([{"text": "命令方块", "color": "orange"},
{"text": ",这", "color": "green"},
{"text": "创造", "color": "blue"},
{"text": "", "color": "green"},
{"text": "毁灭", "color": "red"},
{"text": "的源头,正源源不断地", "color": "green"},
{"text": "扭曲现实", "color": "red"},
{"text": ",唤出你从未见过的", "color": "green"},
{"text": "可怖生灵。", "color": "black"}]);time.sleep(5)
self.TellRawAll({"text": "它们从数据深渊中爬出,带着不属于这个世界的狂暴与诡谲。而你,是被选中之人。", "color": "green"});time.sleep(5)
self.TellRawAll({"text": "▌试炼开启", "color": "red"});time.sleep(5)
self.TellRawAll({"text": "你的剑刃将劈开由代码生成的暗影,你的箭矢将击穿违背常理的怪物洪流。", "color": "black"});time.sleep(5)
self.TellRawAll({"text": "每一波攻势都是命令方块对你生命的嘲弄,而每一次生存都是向终极真相迈进的烙印。", "color": "black"});time.sleep(5)
self.TellRawAll({"text": "▌最终使命", "color": "red"});time.sleep(5)
self.TellRawAll({"text": "当最后一头扭曲造物在你面前崩解成闪烁的粒子,", "color": "black"});time.sleep(5)
self.TellRawAll({"text": "那悬浮于虚空中的命令方块将显露真容——摧毁它,终结这场疯狂的循环。", "color": "black"});time.sleep(5)
self.TellRawAll({"text": "但小心……或许它早已为你准备了最后的", "color": "red"});time.sleep(5)
self.TellRawAll({"text": "惊喜", "color": "red"});time.sleep(5)
self.TellRawAll({"text": ">> 世界能否回归宁静,皆系于你一念之间 <<", "color": "green"});time.sleep(5)
CFAB=_CFAB(host="", password="", port=25565)
CFAB.connect()
# if not CFAB.Connect(): exit()
CFAB.Start()
CFAB.disconnect()
os._exit(0)
CFAB.Bossbar("add", "minecraft:1", '[{"text":"==","color":"red"},{"text":"====","obfuscated":true,"color":"red"},{"text":"==","color":"red"},{"text":" 2","color":"blue"},{"text":"v","color":"yellow"},{"text":"1000","color":"red"},{"text":" \u5973\u5deb","color":"dark_red"},{"text":"\u5927\u8d5b","color":"dark_green"},{"text":" \u751f\u6210","color":"gold"},{"text":"\u8fdb\u5ea6","color":"green"},{"text":" ==","color":"red"},{"text":"====","obfuscated":true,"color":"red"},{"text":"==","color":"red"}]')
CFAB.Bossbar("set", "minecraft:1", "color", "red")
CFAB.Bossbar("set", "minecraft:1", "max", "1000")
CFAB.Bossbar("set", "minecraft:1", "style", "notched_20")
CFAB.Bossbar("set", "minecraft:1", "players", "@a")
CFAB.Bossbar("set", "minecraft:1", "visible", "true")
for _ in range(10, -1, -1):
CFAB.SbSpeak("赛方", f"{_} 秒后开始生成")
time.sleep(1)
# 滚啊看nm呢
B=20
SummonCount=(B-1)*50
for i in range(B, 20+1):
CFAB.SbSpeak("赛方", f"开始生成第 {i} 波女巫,请选手准备迎敌!")
CFAB.SetTitle("@a", f"{i} 波!", "red")
StartRandomTime=random.uniform(0.0, 2.0)
LastRandomTime=StartRandomTime + random.uniform(0, 10.0)
for _ in range(10):
RPos = random.choice(summon_pos)
CFAB.SbSpeak("赛方", f"有一小波女巫生成在了 {RPos}")
for _ in range(5):
CFAB._RunCommand(f"summon minecraft:witch {RPos}")
SummonCount+=1
CFAB.Bossbar("set", "minecraft:1", "value", f"{SummonCount}")
time.sleep(random.uniform(StartRandomTime, LastRandomTime))
CFAB.SbSpeak("赛方", f"{i} 波女巫生成已结束,{"本次比赛已结束" if i == 20 else ("开始 300 秒 中场休息" if i == 10 else "开始 210 秒休息。")}")
time.sleep(0 if i == 20 else (270 if i == 10 else 190))
if i != 20:
CFAB.SbSpeak("赛方", "还有30秒。")
time.sleep(20)
CFAB.SbSpeak("赛方", "最后10秒做好准备")
time.sleep(10)
CFAB.SbSpeak("赛方", "生成已结束!请迅速解决剩余残孽。")
CFAB.SetTitle("@a", "生成完毕!", "green")
com=input("OK?> ")
if com == "Y":
CFAB.SbSpeak("赛方", "恭喜各位完成本次比赛!!!")
time.sleep(5)
CFAB.SbSpeak("赛方", f"诸位凭借自己的实力赢得了 {GC_NUMBER} GC")
else:
CFAB.SbSpeakRaw("赛方", "对不起,你们失败了!", "red")
time.sleep(5)
CFAB.SbSpeak("赛方", "我们下次再见!")
time.sleep(5)
CFAB.SbSpeak("赛方", "我正式宣布比赛结束!")