give me two code that the world code is the one who running the function and code block is the one that disguise as a logic and as a function when running it also for the codeblock use ? var{getEntityName:N,sendMessage:M,broadcastMessage:B,getInventoryItemAmount:A,removeItemName:R,giveItem:G,applyEffect:F,setHealth:H,getHealth:GH,isAlive:L,playSound:S,getPlayerIds:P,setClientOption:O,getMoonstoneChestItemSlot:get,setMoonstoneChestItemSlot:set,getPosition:pos,getBlock:blk}=api;
const OR=[
{n:"Featherling",e:"πͺΆ",hp:65,fx:[{t:"Speed",l:4},{t:"Air Walk",l:2},{t:"Feather Falling",l:3}],ab:{d:15000,cd:54000},c:"#87CEEB",w:1},
{n:"Enderling",e:"ποΈ",hp:90,fx:[{t:"Speed",l:3},{t:"Damage",l:2},{t:"Haste",l:3}],orb:1,wd:1,c:"#9B59B6",w:1},
{n:"Netherling",e:"π₯",hp:132,fx:[{t:"Damage",l:3},{t:"Damage Reduction",l:2},{t:"Heat Resistance",l:10},{t:"Slowness",l:1}],c:"#E74C3C",w:1},
{n:"Warper",e:"β¨",hp:175,fx:[{t:"Speed",l:3},{t:"Damage",l:3},{t:"Damage Reduction",l:3},{t:"Invisible",l:10}],wp:1,c:"#3498DB",w:1},
{n:"Golem",e:"πΏ",hp:210,fx:[{t:"Damage Reduction",l:6},{t:"Slowness",l:2}],ab:{d:15000,cd:135000},c:"#95A5A6",w:1},
{n:"Vampire",e:"π§",hp:145,fx:[{t:"Lifesteal",l:15},{t:"Speed",l:5},{t:"Pickpocketer",l:8}],dw:1,vm:1,c:"#8B0000",w:1},
{n:"Shadow Assassin",e:"π‘οΈ",hp:75,fx:[{t:"Speed",l:2},{t:"Damage",l:5},{t:"Lifesteal",l:5}],nb:1,dw:1,c:"#2C3E50",w:1},
{n:"Druid",e:"πΏ",hp:115,fx:[{t:"Health Regen",l:4},{t:"Damage Reduction",l:2},{t:"Damage",l:2},{t:"Speed",l:1}],c:"#27AE60",w:1},
{n:"Poseidon",e:"π±",hp:150,fx:[{t:"Speed",l:2},{t:"Damage Reduction",l:1}],ps:1,ld:1,c:"#1E90FF",w:1},
{n:"Arachne",e:"π·οΈ",hp:124,fx:[{t:"Speed",l:3},{t:"Damage",l:3},{t:"Damage Reduction",l:1},{t:"Haste",l:1},{t:"Mining Yield",l:1}],ar:1,c:"#8B008B",w:1},
{n:"The Phoenix",e:"π₯",hp:250,fx:[{t:"Speed",l:1},{t:"Damage",l:1}],ph:1,c:"#FF4500",w:0.5},
{n:"Starborn",e:"β",hp:164,fx:[{t:"Speed",l:4},{t:"Damage",l:2},{t:"Invisible",l:5}],sb:1,c:"#FFD700",w:1},
{n:"Apollo",e:"βοΈ",hp:192,fx:[{t:"Damage",l:4},{t:"Speed",l:2},{t:"Damage Reduction",l:3},{t:"Health Regen",l:5}],ap:1,c:"#FFA500",w:1}
];
let D={},T=0,CD={},WT={},EO={},PH={},SB={},GA={},DL=335000,HL=167500,DS=Date.now(),BM=0,LS="day",BMS={};
const data=p=>{if(!D[p]){let s=get(p,0),a=s?.attributes?.customAttributes||{};D[p]={o:a.o||null}}return D[p]},
save=(p,d)=>{D[p]=d;set(p,0,"Dirt",1,{customAttributes:{o:d.o}})},
find=n=>OR.find(o=>o.n===n),
rndOr=ex=>{let av=OR.filter(o=>o.n!==ex);const r=Math.random()*av.reduce((s,o)=>s+o.w,0);let c=0;for(const o of av){c+=o.w;if(r<c)return o}return av[0]},
gui=p=>{const d=data(p);if(!d.o){O(p,"RightInfoText",[{str:"β‘ORIGIN SMPβ‘\n",style:{color:"#FF4500",fontWeight:"bold",fontSize:"18px"}},{str:"Waiting...",style:{color:"white"}}]);return}const o=find(d.o);if(!o)return;const tm=BM?"π©Έ Bloodmoon":LS==="day"?"βοΈ Day":"π Night",tc=BM?"#8B0000":LS==="day"?"#FFD700":"#5555FF";O(p,"RightInfoText",[{str:"β‘ORIGIN SMPβ‘\n",style:{color:"#FF4500",fontWeight:"bold",fontSize:"16px"}},{str:"βββββββββββββ\n",style:{color:"#663399",fontWeight:"bold"}},{str:"β° Time: ",style:{color:"#00D2FF",fontWeight:"bold"}},{str:tm+"\n",style:{color:tc,fontWeight:"bold"}},{str:"βββββββββββββ\n",style:{color:"#663399",fontWeight:"bold"}},{str:"β¨ Origin: ",style:{color:"#FFD700",fontWeight:"bold"}},{str:`${o.e}${o.n}${o.e}\n`,style:{color:o.c,fontWeight:"bold",fontSize:"15px"}},{str:"β€οΈ Max HP: ",style:{color:"#FF6B6B",fontWeight:"bold"}},{str:`${o.hp}\n`,style:{color:"#FFAAAA",fontWeight:"bold"}},{str:"βββββββββββββ\n",style:{color:"#663399",fontWeight:"bold"}},{str:"π« Effects:\n",style:{color:"#00FF88",fontWeight:"bold"}},{str:o.fx.map(x=>` β’ ${x.t} ${x.l}`).join("\n"),style:{color:"#AAFFAA"}},{str:"\nβββββββββββββ\n",style:{color:"#663399",fontWeight:"bold"}}])},
fx=(p,day)=>{const d=data(p);if(!d.o)return;const o=find(d.o);if(!o)return;if(o.dw&&day){F(p,"Slowness",20000,{inbuiltLevel:1});F(p,"Blindness",20000,{inbuiltLevel:10});F(p,"Weakness",20000,{inbuiltLevel:10});return}if(o.vm&&BM){F(p,"Speed",20000,{inbuiltLevel:10});F(p,"Damage",20000,{inbuiltLevel:15});F(p,"Damage Reduction",20000,{inbuiltLevel:8});F(p,"Lifesteal",20000,{inbuiltLevel:25});return}if(WT[p]&&WT[p].debuffEnd>Date.now()){F(p,"Weakness",20000,{inbuiltLevel:5});F(p,"Slowness",20000,{inbuiltLevel:4});F(p,"Blindness",20000,{inbuiltLevel:12});return}if(GA[p]&&GA[p]>Date.now()){F(p,"Damage Reduction",20000,{inbuiltLevel:25});F(p,"Slowness",20000,{inbuiltLevel:2});return}if(PH[p]&&PH[p].active){F(p,"Health Regen",20000,{inbuiltLevel:50});F(p,"Speed",20000,{inbuiltLevel:6});F(p,"Damage",20000,{inbuiltLevel:8});F(p,"Damage Reduction",20000,{inbuiltLevel:5});F(p,"Invisible",20000,{inbuiltLevel:10});F(p,"Lifesteal",20000,{inbuiltLevel:20});F(p,"Haste",20000,{inbuiltLevel:6});F(p,"Heat Resistance",20000,{inbuiltLevel:5});return}const pt=pos(p),b=blk(pt[0],pt[1],pt[2]);if(o.ps&&b==="Water"){F(p,"Speed",20000,{inbuiltLevel:5});F(p,"Hydrated",20000,{inbuiltLevel:10});F(p,"Damage",20000,{inbuiltLevel:7});F(p,"Damage Reduction",20000,{inbuiltLevel:4});F(p,"Health Regen",20000,{inbuiltLevel:3});return}if(o.ap&&!day){F(p,"Weakness",20000,{inbuiltLevel:3});F(p,"Slowness",20000,{inbuiltLevel:2});return}for(const x of o.fx){if(o.nb&&!day&&x.t==="Damage")F(p,"Damage",20000,{inbuiltLevel:15});else if(o.nb&&!day&&x.t==="Speed")F(p,"Speed",20000,{inbuiltLevel:3});else if(o.sb&&!day&&(x.t==="Speed"||x.t==="Damage"))continue;else F(p,x.t,20000,{inbuiltLevel:x.l})}if(o.nb&&!day){F(p,"Blindness",20000,{inbuiltLevel:2});F(p,"Damage Reduction",20000,{inbuiltLevel:3})}};
onPlayerJoin=p=>{const d=data(p);if(!d.o){const o=rndOr();d.o=o.n;save(p,d);O(p,"maxHealth",o.hp);H(p,o.hp);M(p,[{str:`β¨ You are ${o.e}${o.n}${o.e}!\n`,style:{color:o.c,fontWeight:"bold",fontSize:"18px"}},{str:"Check stats on the right!",style:{color:"white"}}]);S(p,"stone1",1,1.5)}else{const o=find(d.o);if(o){O(p,"maxHealth",o.hp);H(p,o.hp)}}O(p,"skyBox",BM?"space_red":LS==="day"?"interstellar":"space_lightblue");gui(p);fx(p,LS==="day")};
onPlayerDamageOtherPlayer=(v,a)=>{const d=data(a);if(!d.o)return;const o=find(d.o);if(o&&o.ar&&Math.random()<0.38){F(v,"Poisoned",25000,{inbuiltLevel:7});M(a,[{str:"π·οΈ Venom strikes!",style:{color:"#8B008B",fontWeight:"bold"}}])}};
function tick(){const now=Date.now();if(now-T<2000)return;T=now;const ps=P(),t=(now-DS)%DL,pday=LS,day=t<HL;LS=day?"day":"night";if(pday&&pday!==LS){if(!day&&Math.random()<0.025){BM=1;for(const i of ps)O(i,"skyBox","space_red");B([{str:"π©Έ BLOODMOON RISES π©Έ\n",style:{color:"#8B0000",fontWeight:"bold",fontSize:"18px"}},{str:"The blood moon watches...",style:{color:"#FF4444",fontSize:"12px"}}]);if(ps.length>0)S(ps[0],"rifle_magazine_load_02",1,.3)}else{BM=0;const sb=day?"interstellar":"space_lightblue";for(const i of ps)O(i,"skyBox",sb);B([{str:day?"βοΈ DAY APPEARS βοΈ\n":"π NIGHT FALLS π\n",style:{color:day?"#FFD700":"#5555FF",fontWeight:"bold",fontSize:"18px"}},{str:day?"The sun rises...":"Stars appear...",style:{color:"#AAAAAA",fontSize:"12px"}}])}for(const i of ps)gui(i)}for(const p of ps){if(!L(p))continue;const d=data(p);if(!d.o)continue;const o=find(d.o);if(!o)continue;const pt=pos(p),x=pt[0],y=pt[1],z=pt[2],b=blk(x,y,z);if(o.wd&&b==="Water"){api.clearInventory(p);H(p,0);B([{str:`π ${N(p)} died from water! π`,style:{color:"#FF0000",fontWeight:"bold"}}]);continue}if(o.ld&&(b==="Lava"||b==="Flowing Lava")){api.clearInventory(p);H(p,0);B([{str:`π ${N(p)} died from lava! π`,style:{color:"#FF0000",fontWeight:"bold"}}]);continue}if(o.n==="Netherling"){if(b==="Water"){H(p,Math.max(0,GH(p)-25))}else if(b==="Lava"||b==="Flowing Lava"){F(p,"Health Regen",4500,{inbuiltLevel:5})}}if(BM){if(y>-25&&!o.vm){H(p,Math.max(0,GH(p)-12))}if(!BMS[p]&&Math.random()<0.15&&!o.vm){BMS[p]=now;const cnt=Math.floor(Math.random()*2)+1;for(let i=0;i<cnt;i++){const m=api.attemptSpawnMob("Draugr Warper",x,y+3,z);if(m){api.setMobSetting(m,"maxHealth",1500);api.setMobSetting(m,"initialHealth",1500);H(m,1500);api.setMobSetting(m,"attackDamage",250)}}M(p,[{str:`π©Έ ${cnt} Draugr Warper(s) spawn!`,style:{color:"#8B0000",fontWeight:"bold"}}])}}else{BMS[p]=0}if(o.orb){if(!EO[p])EO[p]=now;if(now-EO[p]>=20000){G(p,"Moonstone Orb",1);EO[p]=now}}if(o.wp){if(!WT[p])WT[p]={next:now+50000,debuffEnd:0};const w=WT[p];if(w.debuffEnd>0){if(now>=w.debuffEnd){w.debuffEnd=0;w.next=now+50000;M(p,[{str:"β¨ Your powers return!",style:{color:"#3498DB",fontWeight:"bold"}}]);S(p,"stone1",1,1.2)}}else if(now>=w.next){if(Math.random()<0.32){w.debuffEnd=now+120000;M(p,[{str:"β οΈ Your powers fade!",style:{color:"#E74C3C",fontWeight:"bold"}}]);S(p,"rifle_magazine_load_01",1,.5)}else{w.next=now+50000}}}if(o.ph){const hp=GH(p);if(!PH[p])PH[p]={active:0,end:0,cd:0};const ph=PH[p];if(ph.active&&now>=ph.end){ph.active=0;M(p,[{str:"π₯ Phoenix flames fade...",style:{color:"#FF4500",fontWeight:"bold"}}])}else if(!ph.active&&hp<100&&now>=ph.cd){ph.active=1;ph.end=now+120000;ph.cd=now+505000;M(p,[{str:"π₯ PHOENIX RISES!",style:{color:"#FF4500",fontWeight:"bold",fontSize:"18px"}}]);S(p,"stone1",1,1.8)}}if(o.sb){if(!SB[p])SB[p]={last:0};if(now-SB[p].last>=12000&&!day&&Math.random()<0.2){const rnd=Math.random();if(rnd<0.5){F(p,"Health Regen",20000,{inbuiltLevel:10});M(p,[{str:"β Starlight heals you!",style:{color:"#FFD700"}}])}else{M(p,[{str:"β Stars shine brightly!",style:{color:"#FFD700"}}])}SB[p].last=now}}if(GA[p]&&GA[p]<=now){M(p,[{str:"πΏ Defense fades...",style:{color:"#95A5A6"}}]);GA[p]=0}fx(p,day);if(BM&&!o.vm){F(p,"Damage",20000,{inbuiltLevel:6});F(p,"Speed",20000,{inbuiltLevel:5});F(p,"Damage Reduction",20000,{inbuiltLevel:3})}}}
api.onTick&&api.onTick(tick);
onPlayerChat=(p,txt)=>{if(txt.startsWith("!")){const cmd=txt.slice(1).toLowerCase(),d=data(p);if(cmd==="help"){M(p,[{str:"β‘ ORIGIN SMP COMMANDS β‘\n",style:{color:"#FF4500",fontWeight:"bold"}},{str:"!activate",style:{color:"#00D2FF"}},{str:" - Use ability\n",style:{color:"white"}},{str:"!reroll",style:{color:"#00D2FF"}},{str:" - Reroll\n",style:{color:"white"}},{str:"!help",style:{color:"#00D2FF"}},{str:" - Show commands",style:{color:"white"}}]);return false}if(cmd==="reroll"){if(A(p,"Light Blue Paintball")>0){R(p,"Light Blue Paintball",1);const o=rndOr(d.o);d.o=o.n;save(p,d);O(p,"maxHealth",o.hp);H(p,o.hp);gui(p);M(p,[{str:`β¨ You are now ${o.e}${o.n}${o.e}!`,style:{color:"#00FF00",fontWeight:"bold"}}]);B([{str:`${N(p)} rerolled to ${o.e}${o.n}${o.e}!`,style:{color:o.c,fontWeight:"bold"}}]);S(p,"stone1",1,1.5)}else{M(p,[{str:"β Need Reroll Orb!",style:{color:"#FF0000"}}])}return false}if(cmd==="activate"){if(!d.o)return false;const o=find(d.o);if(!o||!o.ab){M(p,[{str:"β No ability!",style:{color:"#FF0000"}}]);return false}const now=Date.now();if(CD[p]&&now<CD[p]){const t=Math.ceil((CD[p]-now)/1000);M(p,[{str:`β° Cooldown: ${t}s`,style:{color:"#FFA500"}}]);return false}if(o.n==="Featherling"){F(p,"Invisible",o.ab.d,{inbuiltLevel:1});M(p,[{str:"π» Invisible!",style:{color:"#87CEEB",fontWeight:"bold"}}]);S(p,"stone1",1,1.5)}else if(o.n==="Golem"){GA[p]=now+o.ab.d;M(p,[{str:"π‘οΈ Max defense!",style:{color:"#95A5A6",fontWeight:"bold"}}]);S(p,"stone1",1,.8)}CD[p]=now+o.ab.cd;return false}return false}const d=data(p);if(!d.o)return false;const o=find(d.o);if(!o)return false;B([{str:`[${o.e}${o.n}${o.e}] `,style:{color:o.c,fontWeight:"bold"}},{str:`${N(p)}: `,style:{color:o.c,fontWeight:"bold"}},{str:txt,style:{color:"white"}}]);return false};