Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def events(id)
- case id
- when 'i1'
- if @start
- Song.current_song.stop if Song.current_song
- @player.ignore=true
- @temp[0]=Message.new("Toad","Toad","Mario, wake up!^^(NOTE: Hold Jump key to speed up^message or press Spin to skip)")
- @map.modify_mask(0,0,:splice,'Backgrounds/MI-mask')
- @temp[3]=120
- end
- if !@temp[1]
- $screen.draw_quad(0,0,c=0xff000000,640,0,c,640,480,c,0,480,c,3.9)
- if @temp[0].closed
- Snd['Jump1'].play
- @player.vx=@player.vy=-6
- @temp[1]=true
- end
- elsif !@temp[2] and @player.vx.to_i==0 and @player.down
- Message.new("Mario","Mario","What? Peach is again in^danger?")
- @temp[2]=Message.new("Toad","Toad","No. Come outside. You^have to see this.")
- end
- if !@temp[2] or !@temp[2].closed
- Img['Objects/Toad'].draw(@temp[3],339,1)
- else
- Tls['Objects/Toadwalk',32,54][[0,1,2,1][$count/8%4]].draw(@temp[3]+32,339,1,-1)
- @temp[3]-=4
- @player.vx=-4
- end
- if @player.x<0
- reset('i2')
- @player.x,@player.y=360,325
- @player.vx=2
- @map.modify_mask(0,0,:splice,'Backgrounds/MH-mask')
- # @map.modify_mask(304,349,:rect,[180,32,0xff000000])
- # @map.modify_mask(340,384,:rect,[240,96,0xff000000])
- end
- when 'i2'
- @temp[0]=Message.new("Mario","Mario","What is this?") if !@temp[0] and @player.vx.to_i==0
- if @temp[0] and @temp[0].closed and @player.x<540
- @player.vx=4
- elsif @temp[0] and @temp[0].closed and !@temp[1] and @player.vx.to_i==0
- @player.mammamia
- Snd['MarioDamage4'].play
- @temp[1]=Message.new("Mario","Mario","WHAT IS BOWSER'S CASTLE^DOING AT MY PLACE?!")
- elsif @temp[1] and @temp[1].closed and !@temp[2]
- @player.demammamia
- @temp[2]=0
- elsif @temp[2] and @temp[2]==120 and !@temp[3]
- Message.new("Toad","Toad","Don't you think it's too^big for Bowser's?^We've sent an expedition,^nobody yet returned.")
- Message.new("Mario","Mario","But Peach is not there?")
- Message.new("Toad","Toad","No, she's safe in another castle.^But anyway you should go.")
- @temp[3]=Message.new("Mario","Mario","Right. I'll make some^exploration.")
- elsif @temp[3] and @temp[3].closed
- @player.vx=4
- if @player.x>640
- reset(0)
- @player.x=0
- @player.y=1288
- # @player.y+=928
- end
- end
- Img['Backgrounds/Castle at home'].draw(0,0,3) if @temp[2] and (@temp[2]+=1)<120
- Img['Objects/Toad'].draw(600,330,1)
- when 0
- if !$save[:events][3]
- if @player.x<300
- @player.vx=4
- else
- Gate.new
- $save[:events][3]=true
- end
- elsif @start
- Gate.new(true)
- end
- when 1
- if !$save[:areas][0]
- @area=["Castle's Entrance",120]
- $save[:areas]<<0
- @map.music 0
- end
- when 3
- if !$save[:events][4]
- if @start
- @temp[0]=800
- @entities[1].each{|ent| ent.remove}
- end
- if @player.x>600 and !@temp[1]
- @player.ignore=true
- @player.vx=2
- Message.new("Toad","Toad2","Oh, it's you Mario!^We have a big problem. It's not^Bowser's castle. This place is^called Castlevania and it's a^property of Count Dracula,")
- Message.new("Toad","Toad2","the Lord of Darkness.^But it also appears to be^controled by Bowser.")
- Message.new("Mario","Mario","This Bowser starts to really^annoy me!")
- Message.new("Toad","Toad2","Anyway, I made small exploration.^Take the map from box,^it may help you.")
- @temp[1]=Message.new("Mario","Mario","Thanks.")
- end
- Img['Objects/Toad2'].draw(@temp[0]+32-@scx,394,2,-1) if !@temp[1] or !@temp[1].closed
- if @temp[1] and @temp[1].closed
- @temp[0]+=4
- @player.ignore=nil
- $save[:events][4]=true
- end
- end
- if @temp[0] and @temp[1] and @temp[1].closed
- Tls['Objects/Toadwalk2',32,54][[0,1,2,1][$count/8%4]].draw(@temp[0]-@scx,394,2)
- @temp[0]+=4
- end
- when 5
- if @start
- ary=[]
- 6.times{|y| ary << [160,192+y*32,'Wall',2]}
- QSwitch.new(192,480,2,false,ary)
- end
- when 6
- BossDoor.new(2528,320) if @start and !$save[:events][0]
- when 7
- if @start and !$save[:events][0] || $bossrush
- BossDoor.new(0,320,true)
- BossDoor.new(608,320,true)
- Msc['Confrontation',true].play
- @temp[0]=BBB.new(512,308)
- end
- $save[:events][0]=true if @temp[0] and @temp[0].dead?
- when 10
- if @start
- ary=[]
- 6.times{|y| ary << [1376,352+y*32+y/3*32,'Wood',[4,8,12,8,12,16][y]]}
- QSwitch.new(1440,192,16,true,ary)
- end
- when 16
- if !$save[:events][1] and $game.player.x>640 and $save[:equip][1]==0 || $save[:items][:magic].include?(0) and !@temp[0]
- @temp[0]=[BossDoor.new(0,288,true),BossDoor.new(1248,288,true)]
- Msc['Fight Against Monsters',true].play
- Spawner.new(64,96,10,30,[:goomba]*20)
- Spawner.new(1184,96,10,30,[:goomba]*20)
- Spawner.new(320,96,5,30,[:gktroopa]*10)
- Spawner.new(864,96,5,30,[:gktroopa]*10)
- Spawner.new(192,96,5,30,[:spiny]*15)
- Spawner.new(992,96,5,30,[:spiny]*15)
- end
- if @temp[0] and !$game.entities[0].find{|ent| ent.class==Spawner}
- @temp[0].each{|door| door.open=true}
- @temp[0]=nil
- @map.music(1)
- $save[:events][1]=true
- end
- when 18
- NPC.new(160,330,'Toad3') if @start
- if !$save[:events][5] and @player.x<320 and !@temp[0]
- @player.ignore=true
- @player.vx=-2
- Message.new("Toad","Toad3","Hi Mario! Wanna shoppin'?")
- Message.new("Mario","Mario","What? You made a shop in the^castle?")
- Message.new("Toad","Toad3","You're going to explore it longer,^so I may have a good income.^Also, I found an interesting map.^Of course it's not free.")
- @temp[0]=Message.new("Mario","Mario","I'll check what you have.")
- elsif @temp[0] and @temp[0].closed
- $save[:events][5]=true
- @player.ignore=nil
- end
- if !$save[:events][34] and $save[:enemies][87] and @player.x<320 and !@temp[1]
- @player.ignore=true
- @player.vx=-2
- Message.new("Toad","Toad3","Hi again Mario!^There's something I must tell^you!")
- Message.new("Mario","Mario","What is it, Toad?")
- Message.new("Toad","Toad3","I've seen a Goomba made of gold!^He must be insanely valuable!")
- Message.new("Mario","Mario","Interesting, I've never seen a^golden Goomba.^Where was it?")
- Message.new("Toad","Toad3","In Goomba halls.")
- @temp[1]=Message.new("Mario","Mario","Right, I will go there later.")
- elsif @temp[1] and @temp[1].closed
- $save[:events][34]=true
- @player.ignore=nil
- end
- Img["Objects/Shop"].draw(200,384-23,1)
- Img["Objects/Shop2"].draw(390,384-8,1) if $save[:events][6]
- Img["Objects/Shop3"].draw(410,384-20,1) if $save[:events][7]
- Img["Objects/Shop4"].draw(320,384-29,1) if $save[:events][10]
- Img["Objects/Shop5"].draw(436,384-17,1) if $save[:events][23]
- Img["Objects/Shop6"].draw(300,384-33,1) if $save[:events][14]
- Img["Objects/Shop7"].draw(520,384-17,1) if $save[:enemies][94] and $save[:enemies][94][0]
- Img["Objects/Shop8"].draw(580,384-17,1) if $save[:cores].length>0
- when 23
- if $save[:cores].length<13
- @map.modify_mask(256,864,:rect,[160,160,0xff000000]) if @start
- $screen.clip_to(240,320,160,160){2.times{|x| Img['Objects/ChaosGate'].draw(240-x*160+$count%160-$game.scx,800-$game.scy,1.8)}}
- end
- when 37
- BossDoor.new(608,768) if @start and !$save[:events][6]
- when 38
- if @start and !$save[:events][6] || $bossrush
- BossDoor.new(0,288,true)
- BossDoor.new(608,288,true)
- Msc['Boss A',true].play
- @entities[1].each{|ent| ent.remove}
- @temp[0]=Unagi.new
- end
- $save[:events][6]=true if @temp[0] and @temp[0].dead?
- when 67,150,152,183,187,188,186,185,151
- r=rand(2)
- r=1 if @player.x<@scx+100
- r=0 if @player.x>@scx+540
- Eerie.new([@scx-44,@scx+638][r],@scy+rand(454),[:right,:left][r]) if @time%120==0
- Eerie.new([@scx-44,@scx+638][r],@scy+rand(454),[:right,:left][r]) if @time%120==0 and rand(8)==0
- Eerie.new([@scx-44,@scx+638][r],@scy+rand(454),[:right,:left][r]) if @time%120==0 and rand(16)==0
- when 71
- # Bobomb.new(1152,-32,:right,true) if @time%240==0
- Crate.new(1120,-96,1+rand(3)) if @time%600==60
- when 76
- BossDoor.new(1248,224) if @start and !$save[:events][7]
- when 77
- if @start and !$save[:events][7] || $bossrush
- BossDoor.new(0,224,true)
- BossDoor.new(1248,224,true)
- Msc['Boss A',true].play
- @entities[1].each{|ent| ent.remove}
- @temp[0]=PUltimatus.new
- end
- $save[:events][7]=true if @temp[0] and @temp[0].dead?
- when 83
- 3.times{|x| 2.times{|y| $game[Tile.new(x*32,1248+y*32,"Sewers",(x==2 ? 9 : 8))]}} if @start and !$save[:items][:misc].include? 3
- when 89
- $save[:area]=1
- @map.music(1) if @start
- if !$save[:events][10] and $game.player.x<640 and !@temp[0]
- @temp[0]=[BossDoor.new(1056,672,true),BossDoor.new(320,672,true)]
- Msc['Fight Against Monsters',true].play
- temp=[]
- temp<<Spawner.new(592,720,1,60,["iplant0"]*5+["venus0"]*5)
- temp<<Spawner.new(656,592,1,60,["venus0"]*5+["mplant0"]*5+["hplant0"])
- temp<<Spawner.new(720,656,1,60,["iplant0"]*5+["mplant0"]*5)
- temp<<Spawner.new(352,528,1,60,["venus1"]*5+["iplant1"]*5)
- temp<<Spawner.new(1008,592,1,60,["mplant3"]*5+["iplant3"]*5)
- Spawner.new(1056,192,5,30,[:vspiny]*15,temp)
- Spawner.new(320,192,5,30,[:vspiny]*15,temp)
- Spawner.new(1024,451,1,180,[:sniper]*2)
- end
- if @temp[0] and !$game.entities[0].find{|ent| ent.class==Spawner}
- @temp[0].each{|door| door.open=true}
- @temp[0]=nil
- @map.music(1)
- $save[:events][10]=true
- end
- when 90
- $save[:area]=8
- @map.music(8) if @start
- if !$save[:areas].include?(8)
- @area=[areas[8],120]
- $save[:areas] << 8
- end
- when 91
- BossDoor.new(0,352) if @start and !$save[:events][15]
- when 92
- if !$save[:events][8]
- if @start
- @entities[1].each{|ent| ent.remove}
- @temp[0]=Luigi.new(400,726)
- end
- if @player.x>240 and !@temp[4]
- @player.vx=2
- Message.new("Luigi","Luigi","That's why this place is called^'skyfall'. I know it's^probably an illusion, but^makes me sick anyway.")
- @temp[2]=Message.new("Mario","Mario","Luigi? What are you doing here?")
- Message.new("Luigi","Luigi","You thought you'll be a hero^again and take all the glory?^I came to take care of Bowser,^so go home.")
- Message.new("Mario","Mario","What are you talking about?^That's our job to protect the^Mushroom Kingdom! We can do it^together as always.")
- @temp[3]=Message.new("Luigi","Luigi","As always? And you will take the^Peach for you and I will be^forever alone. Just assistant^to the great hero. Whole life in^your shadow.")
- @temp[4]=Message.new("Mario","Mario","Luigi, stop!^Oh, that's too bad. Where I made^a mistake?")
- elsif @temp[2] and @temp[2].closed and !@temp[3].closed
- @temp[0].model.mirror_x=true
- elsif @temp[3] and @temp[3].closed
- @temp[0].vx=4
- $save[:events][8]=true if @temp[4].closed
- end
- end
- when 95
- if @start and !$save[:events][19]
- @entities[1].each{|ent| ent.remove}
- @temp[0]=96
- end
- if !$save[:events][19] and @player.x<320 and !@temp[1]
- @player.vx=-2
- Message.new("Toad","Toad4","Hey Mario!")
- Message.new("Mario","Mario","Oh, haven't you seen Luigi?^We met and he seemed weird.")
- Message.new("Toad","Toad4","Luigi? Maybe we missed each^other. But, I made an important^discovery.")
- Message.new("Toad","Toad4","Dracula's true power is sealed^by Bowser somewhere in the cast-^le. And if you want to get rid of^the castle, you need to release^it.")
- Message.new("Mario","Mario","Isn't it dangerous?")
- Message.new("Toad","Toad4","It is. After unsealing it, you^need to defeat Bowser to resur-^rect Dracula. And if you defeat^Dracula, the castle will vanish^from Mushroom Kingdom.")
- Message.new("Mario","Mario","But first, I need to find the^seals.")
- Message.new("Toad","Toad4","It shouldn't be to hard. Defea-^ting Dracula will be much worse.^Anyway, good luck. I'm on my way.")
- @temp[1]=Message.new("Mario","Mario","See ya.")
- elsif @temp[1] and @temp[1].closed
- @temp[0]+=4
- !$save[:events][19]=true
- end
- if @temp[0] and not @temp[1] && @temp[1].closed
- Img['Objects/Toad4'].draw(@temp[0]-@scx,746-@scy,1)
- elsif @temp[0]
- Tls['Objects/Toadwalk4',32,54][[0,1,2,1][$count/8%4]].draw(@temp[0]-@scx,746-@scy,1)
- end
- when 105
- Bobomb.new(1312,-32,:right,true) if @time%120==0
- Bobomb.new(3392,-32,:left,true) if @time%120==0
- Crate.new(1280,-128,1+rand(4)) if @time%240==60
- Crate.new(3328,-128,1+rand(4)) if @time%240==60
- when 106
- BossDoor.new(0,672) if @start and !$save[:events][9]
- when 107
- if !@temp[0] and !$save[:events][9] || $bossrush and @player.x<1168
- Song.current_song.stop
- $premusic=nil
- BossDoor.new(1184,192,true)
- BossDoor.new(1184,672,true)
- @temp[0]=true
- elsif @temp[0] and !@temp[1] and @player.x.between?(600,680)
- Msc['Confrontation',true].play
- @temp[1]=true
- Destroyer.new
- end
- when 109
- 2.times{|x| Crate.new(576+x*256,-128,4)} if @time%60==0
- 3.times{|x| Crate.new(448+x*256,-128,4)} if @time%60==30
- when 110
- Bobomb.new(864,-32,:left,true) if @time%180==0
- Crate.new(832,-128,1+rand(4)) if @time%300==60
- when 116
- r=(@player.x<@scx+320 ? 1 : 0)
- Stoney.new([@scx-44,@scx+638][r],@scy+rand(454),[:right,:left][r],false) if @time%120==0
- when 117,118,128
- r=(@player.x<@scx+320 ? 1 : 0)
- Stoney.new([@scx-44,@scx+638][r],@scy+rand(454),[:right,:left][r],rand(5)==0) if @time%120==0
- when 132,134
- r=(@player.x<@scx+320 ? 1 : 0)
- Stoney.new([@scx-44,@scx+638][r],@scy+rand(454),[:right,:left][r],rand(5)<3) if @time%120==0 and id==134 || @scy<1536
- when 124
- QSwitch.new(992,608,12,nil,[]) if @start
- QSwitch.new(0,0,11,false,[[992,576,"Wood",15]]) if @start
- when 125
- QSwitch.new(0,0,13,false,[[832,352,"Wood",0],[864,352,"Wood",1],[896,352,"Wood",2],[928,352,"Wood",3]]) if @start
- when 126
- QSwitch.new(1088,352,13,nil,[]) if @start
- QSwitch.new(0,0,12,false,[[1024,384,"Wood",15],[960,320,"Wood",15],[992,352,"Wood",15]]) if @start
- when 127
- QSwitch.new(1472,288,11,nil,[]) if @start
- when 135
- BossDoor.new(0,224) if @start and !$save[:events][14]
- when 136
- $game[Background.new(455,64,"Clock")] if @start
- if @start and !$save[:events][14] || $bossrush
- BossDoor.new(0,224,true)
- BossDoor.new(1248,224,true)
- Song.current_song.stop
- $premusic=nil
- end
- if @player.x<640 and !@temp[0] and !$save[:events][14] || $bossrush
- @temp[0]=Death.new
- end
- Tls['Objects/Pointer',42,302][0].draw_rot(640-@scx,240,1,Time.new.min*6,0.5,0.735)
- Tls['Objects/Pointer',42,302][1].draw_rot(640-@scx,240,1,Time.new.hour*15,0.5,0.735)
- when 139
- $save[:area]=10
- @map.music(10) if @start
- when 140
- $save[:area]=11
- @map.music(11) if @start
- if !$save[:areas].include?(11)
- @area=[areas[11],120]
- $save[:areas] << 11
- end
- when 141
- if @start
- $save[:events][35]=false if !$save[:events][36]
- ary=[]
- 8.times{|y| ary << [320,1120+y*32,'Corridor',20]}
- @temp[0]=QSwitch.new(128,256,35,false,ary)
- @temp[1]=0
- QSwitch.new(416,1344,36,false,[])
- end
- if $save[:events][35] and !$save[:events][36]
- @temp[1]+=1
- Snd["Tick"].play if @temp[1]%20==0
- Snd["Tick"].play if @temp[1]%20==10
- if @temp[1]==140
- Snd['Deswitch'].play
- @temp[1]=0
- ary=[]
- 8.times{|y| ary << [320,1120+y*32,'Corridor',20]}
- @temp[0].remove
- $save[:events][35]=false
- @temp[0]=QSwitch.new(128,256,35,false,ary)
- end
- elsif $save[:events][36] and !$save[:events][35]
- @temp[0].press
- end
- when 142
- if @start and !$save[:events][21]
- @entities[1].each{|ent| ent.remove}
- end
- if !$save[:events][21] and @player.x>1300 and !@temp[0]
- Song.current_song.stop
- $premusic=nil
- @player.ignore=true
- @player.vx=2
- Message.new("Mario","Mario","Peach? What are you doing here?")
- Message.new("Peach","Peach","Oh, Mario! Glad you are here.^I got lost, can you guide me to^exit?")
- @temp[0]=Message.new("Mario","Mario","Ugh, I think I can.")
- elsif @temp[0] and @temp[0].closed and !@temp[1]
- Snd['Bowsa'].play
- Snd['MarioDamage4'].play
- @player.mammamia
- @temp[1]=0
- elsif @temp[1] and @temp[1]<90
- @temp[1]+=1
- Img['Effects/Teleport'].draw_rot(1528-@scx,192-@scy,3,0,0.5,0.5,offset_x(@temp[1]*2,5),12,Color.new(offset_x(@temp[1]*2,255).to_i,255,255,255))
- elsif @temp[1] and !@temp[2]
- @player.demammamia
- Message.new("Bowser","Bowser","No, you can't.^Gwahahaha!")
- Message.new("Mario","Mario","Bowser! Stay away of her!")
- Message.new("Bowser","Bowser","Poor Mario, you still think^I kidnap her all the time? As^you see, she comes to^me on her own.")
- @temp[5]=Message.new("Mario","Mario","What the...?!")
- Message.new("Peach","Peach","Don't believe him! It's Bowser,^you know...")
- Message.new("Bowser","Bowser","Gwahahaha! You're mine now!")
- Message.new("Peach","Peach","Mario! Help!")
- Message.new("Mario","Mario","Get your filthy hands off Peach,^Bowser!")
- @temp[2]=Message.new("Bowser","Bowser","We meet in throne room.^Remember also to play with your^brother. Gwahahaha!")
- elsif @temp[2] and @temp[2].closed and !@temp[3]
- Snd['Bowsa'].play
- Snd['Bowser Hahaha'].play
- Snd['PeachScream'].play
- @temp[3]=0
- elsif @temp[3] and @temp[3]<90
- @temp[3]+=1
- Img['Effects/Teleport'].draw_rot(1528-@scx,192-@scy,3,0,0.5,0.5,offset_x(@temp[3]*2,8),12,Color.new(offset_x(@temp[3]*2,255).to_i,255,255,255))
- elsif @temp[3] and !@temp[4]
- Message.new("Mario","Mario","Nooo! That Bowser... The^teleportation... He grew strong.^Is this Dracula's power?")
- @temp[4]=Message.new("Mario","Mario","Ohh, Peach...")
- @player.ignore=false
- elsif @temp[4] and @temp[4].closed
- $save[:events][21]=true
- end
- if !$save[:events][21]
- if @temp[1] and !@temp[5] || !@temp[5].closed
- frame=1
- dir=:right
- else
- frame=0
- dir=:left
- end
- Tls['Objects/Peach',32,78][frame].draw(1450-@scx+(dir==:right ? 32 : 0),306-@scy,2,dir==:right ? -1 : 1) if not @temp[3] && @temp[3]>=45
- Tls['Enemies/Bowser',96,120][0].draw(1576-@scx,264-@scy,2,-1) if @temp[1] and @temp[1]>=45 and not @temp[3] && @temp[3]>=45 ##do poprawy
- end
- when 143
- @map.music 12 if @start and !Song.current_song
- when 156
- if @start and !$save[:events][20]
- @entities[1].each{|ent| ent.remove}
- @temp[0]=1280
- end
- if !$save[:events][20] and @player.x<1600 and !@temp[1]
- @player.vx=-2
- Message.new("Toad","Toad4","Oh, hi again! I made a small re-^search on these teleport pipes.^As you noticed, they allow you^to move across the castle with^speed of light.")
- Message.new("Toad","Toad4","But moreover, they cause a^distortion in space around them.")
- Message.new("Mario","Mario","So, what exactly it is?")
- Message.new("Toad","Toad4","It's a tunnel to parrarel dimen-^sion. Well, theoretically. I have^no idea if it's even possible to^to enter there.")
- Message.new("Mario","Mario","Nah, so I don't even bother.")
- @temp[1]=Message.new("Toad","Toad4","Anyway, see you later.")
- elsif @temp[1] and @temp[1].closed
- @temp[0]+=4
- !$save[:events][20]=true
- end
- if @temp[0] and not @temp[1] && @temp[1].closed
- Img['Objects/Toad4'].draw(@temp[0]-@scx,298-@scy,1)
- elsif @temp[0]
- Tls['Objects/Toadwalk4',32,54][[0,1,2,1][$count/8%4]].draw(@temp[0]-@scx,298-@scy,1)
- end
- when 157
- if @start
- ary=[]
- 2.times{|x| ary << [800+x*32,160,'Shrine',13]}
- QSwitch.new(960,320,17,false,ary)
- end
- when 159
- if @start and !$save[:events][15] || $bossrush
- BossDoor.new(0,32,true)
- BossDoor.new(1248,832,true)
- Song.current_song.stop
- @entities[1].each{|ent| ent.remove}
- Goombfalloon.new
- end
- when 160
- if @player.x.between?(64,320) and @player.y>384 and @player.crouch
- @temp[0]||=0
- @temp[0]+=1
- if @temp[0]==300 and !@temp[1] and !$save[:items][:misc].include?(3)
- @temp[1]=true
- Item.new(@player.x-16,192,:misc,3).vy=-16
- end
- else
- @temp[0]=nil
- end
- GGoomba.new(0,416) if @start and $save[:enemies][87]
- when 172
- Bobomb.new(160,-32,:right,true) if @time%60==0
- when 181
- BossDoor.new(1248,256) if @start and !$save[:events][18]
- when 182
- if @start and !$save[:events][18] || $bossrush
- BossDoor.new(0,256,true)
- BossDoor.new(608,256,true)
- Msc['Chaotic Playground',true].play
- @temp[0]=0
- @temp[1]=-1
- @temp[2]=[]
- end
- if @temp[0] and @temp[2]
- @temp[2] << BooFormation.new(@temp[1]+=1) if @temp[0]%40==0
- @temp[0]+=1
- @temp[0]=nil if @temp[0]==321
- end
- if @temp[2] and boo=@temp[2][0].hp<=10000
- if boo=@temp[2].find{|boof| boof.hp<=0}
- @temp[2].each{|boof| boof.die if boof != boo}
- @temp[2]=nil
- else
- @temp[2].each{|boof| boof.action}
- end
- end
- if @temp[2] and boo=@temp[2][0].hp<=5000
- if boo=@temp[2].find{|boof| boof.hp<=0}
- @temp[2].each{|boof| boof.die if boof != boo}
- @temp[2]=nil
- else
- @temp[2].each{|boof| boof.action}
- end
- end
- if @temp[2]
- min=100000
- @temp[2].each{|t| min=t.hp if t.hp<min}
- @temp[2].each{|t| t.hp=min}
- end
- when 189
- BossDoor.new(608,320) if @start and !$save[:events][22]
- when 190
- if @start and !$save[:events][22] || $bossrush
- BossDoor.new(0,320,true)
- BossDoor.new(1888,320,true)
- Msc['Confrontation',true].play
- ToxBoxMax.new
- end
- when 206
- BossDoor.new(0,224) if @start and !$save[:events][23]
- $game.map.music(12) if @start and !Song.current_song
- when 207
- if @start and !$save[:events][23] || $bossrush
- BossDoor.new(0,224,true)
- BossDoor.new(1248,224,true)
- Song.current_song.stop
- $premusic=nil
- @entities[1].each{|ent| ent.remove if ent.class != Luigi}
- @temp[2]=Luigi.new(320,390)
- end
- if @player.x<520 and !@temp[0] and !$save[:events][23]
- @player.vx=-2
- Message.new("Mario","Mario","Luigi?")
- Message.new("Luigi","Luigi","Mario... Peach is in castle...")
- Message.new("Mario","Mario","I know. Let's go and save her^together.")
- Message.new("Luigi","Luigi","No, this time I'll be the one...^I will be the PLAYER ONE!!")
- Message.new("Mario","Mario","WTF are you saying? Luigi! Come^on!")
- @temp[0]=Message.new("Luigi","Luigi","Mario... Brother...^Your mission ends... Here...")
- elsif @temp[0] && @temp[0].closed && !@temp[1] or $bossrush && !@temp[1]
- @temp[1]=true
- Msc['Fight Against Culex',true].play
- @temp[2].boss!
- end
- when 208
- $game.map.music(12) if @start and !Song.current_song
- when 213
- QSwitch.new(640,352,24,nil,[]) if @start
- when 214
- QSwitch.new(608,480,25,nil,[]) if @start
- when 215
- if @start
- 4.times{|i| ary=[]
- 4.times{|y| ary << [1088+i*32,192+y*32,'Bonus',y==0 ? 5 : y==3 ? 27 : 16]}
- QSwitch.new(i==2 ? 480 : 0,i==2 ? 544 : 0,24+i,nil,ary)}
- end
- when 216
- QSwitch.new(768,448,27,nil,[]) if @start
- when 218
- if !$save[:events][31] and !@temp[0] and @player.x>128
- @player.mammamia
- Snd['MarioDamage4'].play
- @temp[0]=Message.new("Mario","Mario","DAFUQ? This stupid Bowser!^Why the hell would he keep^such slanderous pictures?")
- elsif @temp[0] and @temp[0].closed
- $save[:events][31]=true
- @player.demammamia
- end
- when 222
- BossDoor.new(608,1280) if @start and !$save[:events][30]
- when 223
- if @start and !$save[:events][30] || $bossrush
- BossDoor.new(0,320,true)
- BossDoor.new(1248,320,true)
- Msc['Confrontation',true].play
- Lakithunder.new
- end
- when 242
- @map.music 15 if !Song.current_song
- @entities[1].each{|ent| ent.remove} if @start and !$save[:events][28]
- when 243
- if @start and !$save[:events][28]
- Song.current_song.stop
- $premusic=nil
- end
- if $save[:relics][10] and !@temp[0] and !$save[:events][28] and !$bossrush
- Snd['Kamek Hahaha'].play
- @player.vx=-2
- @temp[2]=Kamek.new(0,380)
- Message.new("Kamek","Kamek","Well, well... Who do we have^here?")
- Message.new("Mario","Mario","Kamek?")
- Message.new("Kamek","Kamek","Indeed, it's me. Long way you had^to go, but you came here finally.")
- if !$save[:relics][9]
- Message.new("Kamek","Kamek","You didn't find castle's biggest^secret and I'm going to make sure^you won't.")
- else
- Message.new("Kamek","Kamek","You found castle's big secret.^I'm going to put an end to you.^You are such a troublemaker.")
- end
- Message.new("Mario","Mario","It is your fault! You cursed^Luigi and are responsible for^summoning the castle!")
- Message.new("Kamek","Kamek","How clever you are! I'm really^impressed! But it is obvious that^Bowser wouldn't make all of this^if not my powerful magic.")
- Message.new("Kamek","Kamek","It is me who summoned Dracula's^castle to this world and it is^me who mastered the control over^it's power.")
- Message.new("Mario","Mario","What for? Aren't you enough?")
- Message.new("Kamek","Kamek","For master Bowser of course!^I did it all so he can finally^take control over Mushroom^Kingom. And princess Peach will^be finally his own.")
- Message.new("Kamek","Kamek","We were planning to launch an^attack to the kingdom, but you^came here bringing this stupid^princess with you. That's even^better and easier that way.")
- @temp[0]=Message.new("Kamek","Kamek","And this is as far as you will^go.^PERISH NOW! MARIO!")
- elsif @temp[0] && @temp[0].closed && !@temp[1] or $bossrush && !@temp[1]
- @temp[2]||=Kamek.new(0,380)
- @temp[2].start=@temp[1]=true
- BossDoor.new(1248,288,true)
- Msc['Fight Against Culex',true].play
- end
- when 248
- if @start
- BossDoor.new(0,320)
- end
- when 249
- # return @start=nil if @bowser and !@temp[11] and !@temp[30]##
- # return @bowser=Bowser.new(@scx+32,296) if @start and !@temp[11] and !@temp[30]##
- if @start and !@temp[1] and !@temp[11] and !@temp[30] and !$bossrush
- BossDoor.new(1248,320,true)
- @player.ignore=true
- Msc['Item Room'].play true
- @temp[0]=Sprite.new(588,237,'Enemies/Bowser',96,120)
- @temp[8]=Sprite.new(604,310,'Effects/Cup',16,23)
- @temp[0].frame=7
- Message.new("Bowser","Bowser","Mario! Whadya doin' here?^Kamek was supposed to stop you^from coming.")
- @temp[1]=Message.new("Mario","Mario","Your dear and reliable almighty^super-sorcery devoted minion...^has...^failed.")
- elsif @temp[1] and @temp[1].closed and !@temp[2]
- @temp[0].frame=9
- Message.new("Bowser","Bowser","Kamek has... failed? You^defeated even Luigi, your own^brother?")
- Message.new("Bowser","Bowser","Well, that's no surprise.^They have always been useless.^That's why you are the main hero^and I am the main badass villain.")
- Message.new("Mario","Mario","I will avenge Luigi!")
- @temp[2]=Message.new("Bowser","Bowser","Something bad happened? Well,^that's so sad. So much sad.^Gwahahahahahahahaha!!!")
- elsif @temp[2] and @temp[2].closed and !@temp[7]
- @temp[0].animation(4,10,11,12,11)
- @temp[7]=0
- Snd['Bowser Hahaha'].play
- elsif @temp[7] and !@temp[9] and (@temp[7]+=1)==180
- @temp[8].angle=135
- @temp[8].x=618
- @temp[8].y=276
- @temp[9]=true
- @temp[7]=0
- @temp[0].frame=13
- elsif @temp[9] and !@temp[3] and (@temp[7]+=1)==60
- Snd['Bowser Hit'].play
- @temp[8].remove
- Particle.new(618,276,1.5,'Effects/Cup',-4,-8,:rotate=>-8,:wine=>true)
- @temp[0].frame=5
- @temp[3]=Message.new("Bowser","Bowser","YUCK!!^The hell is wrong with this^wine?!")
- elsif @temp[3] and @temp[3].closed and !@temp[4]
- @temp[0].frame=0
- @temp[0].y=296
- Message.new("Bowser","Bowser","Enough talking. Let's just finish^it Mario. Peach is mine, I am^pretty immortal with my powers.^I will just crush you, 'kay?")
- @temp[4]=Message.new("Mario","Mario","Yeah, whatever.")
- elsif @temp[4] and @temp[4].closed and !@temp[10]
- Song.current_song.stop
- Snd['Bowsa'].play
- @temp[10]=Trace.new(@temp[0].x+48,0,2,'Effects/Teleport',8,:vanish=>true)
- elsif @temp[10] && @temp[10].removed && !@temp[5] or $bossrush && !@temp[5]
- BossDoor.new(1248,320,true) if $bossrush
- Msc['Fight Against Culex',true].play
- @temp[5]=true
- @player.ignore=false
- Bowser.new(@scx+32,296)
- end
- if @temp[0] and !@temp[6]
- @player.vx=-4
- @temp[6]=true if @player.x<750
- end
- if @temp[10] and @temp[10].vanish
- @temp[0].remove
- end
- if @temp[11] and flashing==64
- Message.new("Bowser","Bowser","I've failed. Mario, you fool.^Defeat Dracula or our world is^done.")
- elsif @temp[11] and !flashing and !@temp[12]
- Snd['Bats'].play
- @temp[12]=0
- elsif @temp[12] and @temp[12]<120
- @temp[12]+=1
- angle=rand(360)
- Trail.new(520+rand(44)-offset_x(angle,72),280+rand(126)-offset_y(angle,72),2.2,['Effects/Bat',15,15,0],[0,1,2,1]*3,3,:movex=>offset_x(angle,2),:movey=>offset_y(angle,2)) if @temp[12]%3==0
- @temp[16]=Sprite.new(520,280,'Enemies/Dracula',74,156) if @temp[12]==60
- elsif @temp[12] and @temp[12]==120 and !@temp[13]
- @temp[13]=Message.new("Dracula","Dracula","I am count Dracula, the true^master...")
- elsif @temp[13] and @temp[13].closed and !@temp[14]
- Snd['Fire1'].play
- @temp[15]=Trail.new(537,280,2.2,['Effects/Fire1',40,92,0],[0,1,2,3]*999,4)
- Message.new("Dracula","Dracula","Wah! Who the hell put glass roof^in the throne room?")
- @temp[14]=Message.new("Dracula","Dracula","Oh no! The sun, it burns!")
- elsif @temp[14] and @temp[14].closed and !@temp[17]
- @temp[15].remove
- @temp[16].remove
- Trail.new(520,280,2,['Effects/Dracend',74,156,0],[0,1,2,3],16)
- @temp[17]=Message.new("Mario","Mario","Well, that was awkward.")
- elsif @temp[17] and @temp[17].closed and !@temp[18]
- @temp[19]=Snd['Earthquake'].play
- $game.shake(8,4,9999)
- @temp[18]=Timer.new(60)
- elsif @temp[18] and @temp[18].finished and !@temp[20]
- @temp[20]=Message.new("Bowser","Bowser","Ok, Mario, you won.^This castle is yours now.^I'm outta here.")
- Message.new("Mario","Mario","Finally, my own castle!^I'm so happy :))))))")
- elsif @temp[20] and @temp[20].closed and !@temp[21]
- @temp[21]=Sprite.new(384,480,'Enemies/Clown',128,128,true)
- @temp[21].animation(4,0,1,2,3)
- @temp[23]=@entities[0].find{|ent| ent.class==Sprite and ent.x==400}
- elsif @temp[21] and !@temp[22]
- @temp[21].y-=4
- @temp[23].y-=4 if @temp[21].y<=364
- if @temp[21].y<=240
- Message.new("Bowser","Bowser","You should practice your sarcasm,^Mario.")
- Message.new("Mario","Mario","And you should practise your^fighting.")
- @temp[22]=Message.new("Bowser","Bowser","It's not over. One day,^Peach will be all mine.")
- end
- elsif @temp[22] and @temp[22].closed and !@temp[24]
- @temp[24]=Timer.new(120)
- elsif @temp[24] and @temp[24].finished and !@temp[25]
- @temp[25]=Message.new("Mario","Mario","By the way, where's Peach?")
- elsif @temp[25] and !@temp[26]
- @temp[26]=Sprite.new(1280,338,'Objects/Peach',32,78)
- @temp[26].animation(8,0,2)
- @temp[27]=Luigi.new(1200,375)
- elsif @temp[26] and @temp[26].x>800
- @temp[26].x-=4
- @temp[27].vx=-4
- elsif @temp[26] and !@temp[28]
- @temp[26].frame=0
- @player.vx=2
- @temp[27].vx=-0.1
- Message.new("Luigi","Luigi","Mario! Found you at last!")
- Message.new("Mario","Mario","Luigi? So you are alive?")
- Message.new("Mario","Mario","And... P-p-p-each!!!")
- Message.new("Peach","Peach","I'm alright. Don't worry, honey.")
- Message.new("Luigi","Luigi","I was eaten by the curse.^You freed me by breaking the^seal.")
- Message.new("Luigi","Luigi","But this time, I saved the Peach.")
- Message.new("Peach","Peach","He is right. I'm now all his,^for some time of course.")
- Message.new("Luigi","Luigi","And who is the player one now?!")
- Message.new("Mario","Mario","I just want to leave this damn,^collapsing castle.")
- @temp[28]=Message.new("Luigi","Luigi","I know the way to exit.^Everyone else has left safely^already.")
- elsif @temp[28] and @temp[28].closed
- ##jescze animka rozwalania zamku
- $game=End.new(true)
- end
- @temp[19]=Snd['Earthquake'].play if @temp[19] and !@temp[19].playing?
- if @temp[24]
- @temp[21].y-=4
- @temp[23].y-=4
- end
- if @temp[30] and !@temp[31]
- @temp[31]=Timer.new(120)
- @player.ignore=true
- elsif @temp[31] and @temp[31].finished and !@temp[32]
- Message.new("Mario","Mario","What will I do now?")
- Message.new("Mario","Mario","Luigi is dead.^Peach is missing.")
- Message.new("Mario","Mario","PEACH!! I didn't find her.")
- Message.new("Mario","Mario","I want to destroy this castle.^This Bowser is so tiring.^I don't know what to do.")
- @temp[32]=Message.new("Mario","Mario","Is there something I missed?")
- elsif @temp[32] and @temp[32].closed
- $game=End.new(false)
- end
- when 252
- if @start and !@temp[0] and !$save[:events][29] || $bossrush
- BossDoor.new(0,224,true)
- BossDoor.new(608,224,true)
- Msc['Confrontation',true].play
- OmniSledge.new(416,224)
- end
- when 267
- if @start
- ary=[]
- 3.times{|y| ary << [224+y*32,256,'Shrine',13]}
- QSwitch.new(576,384,32,false,ary)
- TheDoor.new(3456,352)
- end
- when '45a'
- Tls['Objects/Pointer',42,302][0].draw_rot(320-@scx,416-@scy,1,-$count*15,0.5,0.735)
- Tls['Objects/Pointer',42,302][1].draw_rot(320-@scx,416-@scy,1,-$count,0.5,0.735)
- when '7a' ; BossDoor.new(0,1248) if @start and !$save[:cores].include?('7a')
- BangStar.new(@scx+rand(606),@scy-102) if rand(60)==0 and !stopped
- when '13a'
- TheDoor.new(896,416) if @start
- when '26a' ; BossDoor.new(1888,768) if @start and !$save[:cores].include?('26a')
- when '33a' ; BossDoor.new(5728,288) if @start and !$save[:cores].include?('33a')
- when '38a' ; BossDoor.new(0,288) if @start and !$save[:cores].include?('38a')
- when '43a' ; BossDoor.new(1248,288) if @start and !$save[:cores].include?('43a')
- when '54a' ; BossDoor.new(0,288) if @start and !$save[:cores].include?('54a')
- when '64a' ; BossDoor.new(608,768) if @start and !$save[:cores].include?('64a')
- when '66a' ; BossDoor.new(1888,288) if @start and !$save[:cores].include?('66a')
- when '68a' ; BossDoor.new(0,288) if @start and !$save[:cores].include?('68a')
- when '75a' ; BossDoor.new(0,288) if @start and !$save[:cores].include?('75a')
- when '98a' ; BossDoor.new(608,288) if @start and !$save[:cores].include?('98a')
- when '102a' ; BossDoor.new(0,288) if @start and !$save[:cores].include?('102a')
- when '114a' ; BossDoor.new(0,288) if @start and !$save[:cores].include?('114a')
- end
- @start=nil
- end
- def areas
- ["Castle's Entrance","Tangled Garden","Waterway","Dimensional Distortion","Corridor of Infinity","Pipeline","Haunted Library","Weapons Factory","Chambers of Goombas","Skyfall Shrine","Clock Tower","Bonus Area","Catacombs","Forbidden Cave","The Abyss","Halls of Bowser"]
- end
- class Load
- def initialize
- Fnt[['System/Font',20,20],['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9','0','.','/',':','!','@','%','?','_','-',',','<','>','+',"'",'#','(',')']]
- Fnt[['System/Damage1',14,16],['1','2','3','4','5','6','7','8','9','0','-','+']]
- Fnt[['System/Damage2',14,16],['1','2','3','4','5','6','7','8','9','0','-','+']]
- (Dir.entries('data/music')-['.','..']).each{|msc| Msc[msc.chomp('.ogg')]}
- return
- (Dir.entries('data/gfx')-['.','..']).each{|dir| (Dir.entries('data/gfx/'+dir)-['.','..']).each{|img| if img.end_with?('png')
- Img[dir+'/'+img.chomp('.png')]
- else
- (Dir.entries('data/gfx/'+dir+'/'+img)-['.','..']).each{|img2| Img[dir+'/'+img+'/'+img2.chomp('.png')]}
- end}}
- (Dir.entries('data/sfx')-['.','..']).each{|sfx| Snd[sfx.chomp('.ogg')]}
- end
- def update
- end
- def draw
- $shaders||=[Ashton::Shader.new(fragment: "data/stone.frag"),Ashton::Shader.new(fragment: "data/curse.frag"),Ashton::Shader.new(fragment: "data/poison.frag"),Ashton::Shader.new(fragment: "data/protec.frag"),Ashton::Shader.new(fragment: "data/starman.frag")]
- $game=MainMenu.new
- end
- def Load.Model(name)
- model=Marshal.load(f=File.new("data/models/#{name.downcase}.2dm",'r'))
- f.close
- model
- end
- def Load.Animation(name)
- anim=Marshal.load(f=File.new("data/models/animations/#{name.downcase}.2da",'r'))
- f.close
- anim
- end
- end
- class Model
- attr_accessor :x,:y,:z,:skin,:angle,:mirror_x,:mirror_y
- attr_reader :bones,:order
- def initialize
- @bones={}
- @order=[]
- @x=@y=@z=@angle=0
- end
- def update
- @bones.each_value{|bone| bone.update}
- end
- def draw
- scale(@mirror_x ? -1 : 1, @mirror_y ? -1 : 1, @x, @y) do
- @order.each{|bone| x1,y1=bone_origin(bone) ; x2,y2=bone_tip(bone) ; @bones[bone].draw(x1,y1,x2,y2)}
- end
- end
- def bone_origin(name)
- if @bones[name].parent != self
- x,y=bone_tip(@bones[name].parent)
- x+=-offset_y(@bones[@bones[name].parent].angle,@bones[name].offset_x)-offset_x(@bones[@bones[name].parent].angle,@bones[name].offset_y)
- y+=-offset_y(@bones[@bones[name].parent].angle,@bones[name].offset_y)+offset_x(@bones[@bones[name].parent].angle,@bones[name].offset_x)
- else
- x,y=@x,@y
- x+=-offset_y(@angle,@bones[name].offset_x)-offset_x(@angle,@bones[name].offset_y)
- y+=-offset_y(@angle,@bones[name].offset_y)+offset_x(@angle,@bones[name].offset_x)
- end
- [x,y]
- end
- def bone_tip(name)
- return @x,@y if name==self
- x,y=bone_origin(name)
- x+=offset_x(@bones[name].angle,@bones[name].length)
- y+=offset_y(@bones[name].angle,@bones[name].length)
- [x,y]
- end
- def animation(animation,args={})
- animation.frames.each_pair do |name,frames|
- @bones[name].animation(animation, frames, args[:delay] ? args[:delay] : 1, args[:loop], args[:override], args[:keep]) if !@bones[name].animation? or @bones[name].animation? != animation && args[:force] || @bones[name].animation? == animation && args[:repeat]
- end
- return
- return if animation==@animation and !args[:repeat]
- return if @animation and !args[:force]
- @delay||=1
- args[:delay]||=@delay
- @delay=args[:delay]
- @loop=args[:loop]
- @animation=animation
- @count=@delay-1
- if args[:smooth]
- @frame=-1
- else
- @frame=0
- @animation.frames[0].bones.each_pair{|name,angle| @bones[name].angle0=angle if @bones[name]}
- end
- end
- def stop
- @bones.each_value{|bone| bone.animation(nil,nil,nil)}
- end
- def add_bone(name)
- @bones[name]=Bone.new(self,(@select and @select != name) ? @select : self)
- @order << name
- @bones[name]
- end
- end
- class Bone
- attr_accessor :length,:angle0,:skin,:mirror_x,:mirror_y,:offset_x,:offset_y,:origin_x,:origin_y
- attr_reader :parent
- # attr_reader :angle, :parent
- def initialize(model,parent)
- @model,@parent=model,parent
- @length=@angle=@angle0=@offset_x=@offset_y=0
- @origin_x=@origin_y=0.5
- end
- def update
- if @animation
- return if @animation_frame==@animation.length and @animation_keep
- @angle0=@animation[@animation_frame]
- @animation_time+=1
- if @animation_time == @animation_delay
- @animation_frame+=1
- @animation_time=0
- end
- if @animation_frame==@animation.length
- if @animation_loop
- @animation_frame=0
- elsif !@animation_keep
- @animation=@animation_override=@animation_name=nil
- end
- end
- end
- # @angle=@angle0+(parent.class == Model ? parent.angle : @model.bones[parent].angle)
- end
- def draw(x1,y1,x2,y2)
- parent = (@parent.class==Model ? @model : @model.bones[@parent])
- Img["models/skins/#{@model.skin}/#{@skin}"].draw_rot((x1+x2)/2,(y1+y2)/2,@model.z,angle,@origin_x,@origin_y,@mirror_x ? -1 : 1,@mirror_y ? -1 : 1)
- end
- def animation(animation, frames, delay, loop, override, keep)
- return if @animation_override and !override
- @animation_name=animation
- @animation=frames
- @animation_frame=0
- @animation_time=0
- @animation_delay=delay
- @animation_loop=loop
- @animation_override=override
- @animation_keep=keep
- end
- def animation?
- @animation_name
- end
- def angle
- @angle0+(parent.class == Model ? parent.angle : @model.bones[parent].angle)
- end
- end
- class Animation
- attr_reader :frames
- def initialize
- @frames={}
- end
- end
- class Enemy < Entity
- attr_reader :name
- attr_accessor :hp,:nodrop
- def initialize(enemy)
- enemy=$enemies.index{|en| en[:name]==enemy}
- @name=$enemies[enemy][:name]
- @hp=$enemies[enemy][:hp]
- @sp=$enemies[enemy][:sp]
- @attack=$enemies[enemy][:attack]
- @exp=$enemies[enemy][:exp]
- @defence=($enemies[enemy][:defence] ? $enemies[enemy][:defence] : 0)
- @resistance=($enemies[enemy][:resistance] ? $enemies[enemy][:resistance] : 0)
- @tolerance=($enemies[enemy][:tolerance] ? $enemies[enemy][:tolerance] : [])
- @weakness=($enemies[enemy][:weakness] ? $enemies[enemy][:weakness] : [])
- @id=enemy
- @unstoppable=true
- @setinv=30
- @element=$enemies[enemy][:element]
- @offx||=0
- @offy||=0
- end
- def update
- @offx||=0
- @offy||=0
- @inv=nil if @invincible
- preact if !@active
- return @active=(@x.between?($game.scx-size[0],$game.scx+640) and @y.between?($game.scy-size[1],$game.scy+480)) if !@active
- if @hp and @hp<=0
- dead
- return if @dead
- @dead=true
- if @nodrop
- Star.new(@x,@y,rand(50)==0) if @nodrop==:star and rand(5)==0
- return
- end
- $save[:exp]+=(@exp*($save[:equip][4]==5 ? 1.2 : 1)).round
- $save[:enemies][@id] ||= []
- $save[:kills][@id] ||= 0
- $save[:kills][@id]+=1
- $save[:allkills]+=1
- drop=$enemies[@id][:drop]
- dropped=nil
- drop.each{|drp| if !dropped and rand(100000)<(drp[2]+$save[:luck]*0.025)*([$save[:equip][6],$save[:equip][7]].include?(3) ? 2 : 1)*1000
- dropped=true
- @drop=Item.new(@x+size[0]/2-16,@y+size[1]-32,drp[0],drp[1])
- $save[:enemies][@id][drop.index(drp)]=true end}
- if !dropped and rand(100000)<(0.5+$save[:luck]*0.025)*($save[:equip][0]==3 ? 15 : 1)*1000
- coin=rand([$save[:equip][6],$save[:equip][7]].include?(11) ? 8 : 4)
- Coin.new(@x+size[0]/2-[10,14,14,16,20,14,16,20][coin],@y+size[1]-[32,32,32,50,42,32,50,42][coin],coin)
- end
- $save[:magic][@magic][0]+=@sp if @magic
- else
- action if not !@unstoppable2 && $game.stopped
- @attacked=@damaged=@stomped=@powed=nil
- if !@harmless and !$game.gameover and !pl.inv || @omnir and $save[:hp]>0 and collide
- if pl.starman
- self.damage($save[:strength]+100,true,nil) if self.respond_to? :damage
- return
- end
- return pl.inv=60 if ($save[:equip][0]==5 and rand(5)==0)
- return @attacked=true if self.class==Spikes and $save[:equip][0]==2
- $game.player.reset
- Snd["MarioDamage#{1+rand(5)}"].play
- pl.inv=@setinv
- damage=@attack-(@matk ? $save[:mind] : $save[:defence])
- 8.times{|i| damage/=2 if $save[:resistance][i]==@element} if @element
- damage=1 if damage<=0
- damage*=2 if $save[:status]=='STONE'
- damage=100 if @absolute100
- $save[:hp]-=damage
- Info.new(pl.x-damage.to_s.length*7,pl.y-40,damage,"Damage1")
- pl.vx=6*(pl.x<@x+size[0]/2 ? -1 : 1)*(@knockback ? @knockback : 1) if $save[:status]!='STONE' and $save[:equip][0]!=2
- pl.vy=-10 if $save[:status]!='STONE' and $save[:equip][0]!=2 and @knockback != 0
- @attacked=damage
- $save[:status]=['POISON',"CURSE","STONE"][@element-8] if $save[:status]!='PROTEC' and [8,9,10].include?(@element) and !$save[:resistance].include?(@element)
- if self.class != Projectile and $save[:equip][0]==11
- self.damage($save[:intelligence]/2,true,5)
- Snd['Blast'].play
- Trail.new(pl.x-21,pl.y-20,3,['Effects/Backfire',42,40],[0,1,2,3],8)
- end
- end
- end
- @inv=nil if @inv and (@inv-=1)==0
- remove if !@notoffmap and @x>$game.map.data[:width]*640 || @x+size[0]<0 || @y>$game.map.data[:height]*480 || !@notoffup && @y+size[1]<0
- end
- def stomp(x,y,pound)
- return if !@active or @inv or @immortal or @unstompable && @unstompable != :solid && $save[:equip][5] != 1 && $save[:equip][0] != 2 && (@unstompable !=true || pound !=:spin) or @unstompable==:through
- if x+12>@x+@offx and x-12<@x+@offx+size[0] and y+24>@y+@offy-8 and y-40<@y+@offy+size[1]
- $game.enemy=self
- @invincible ? Snd['Guard'].play : dam_snd ? dam_snd.play : Snd['Stomp'].play
- $game.player.bounce
- return if @unstompable==:solid
- damage($save[:stomp]*(pound==:spin ? 1.5 : (pound and pound != :slide) ? 2 : 1),false,($save[:equip][5]==2 and !pound || pound==:spin) ? 1 : 0)
- @stomped=true
- end
- end
- def pow(x,y,width,pound)
- return if !@active or @inv or @immortal
- if x<@x+size[0] and x+width>@x+@offx and y<@y+size[1] and y>@y+@offy
- $game.enemy=self
- # Snd['Stomp'].play
- # $game.player.bounce if !pound
- damage($save[:stomp]*(pound ? 2 : 0.5),false,0)
- @powed=(pound ? :pound : true)
- end
- end
- def kill(x,y,sizex,sizey,attack,element,id,inv=nil)
- return if @inv or !@active or @immortal
- if x+sizex>@x+@offx and x<@x+@offx+size[0] and y+sizey>@y+@offy and y<@y+@offy+size[1]
- $game.enemy=self
- @invincible ? Snd['Guard'].play : dam_snd ? dam_snd.play : Snd['Stun'].play
- damage(attack,![nil,0,1,2].include?(element),element)
- @magic=id if id
- @inv=inv if inv
- true
- end
- end
- def pl;$game.player;end
- def damage(attack,magical,element,ix=@x+@offx+size[0]/2,iy=@y)
- return if !@hp
- iy=@iy if @iy
- return Info.new(ix-24,iy-20,attack,Tls['System/Status',48,16][3]) if @invincible
- return if @immortal
- if attack==:absolute
- attack=77
- elsif attack.class==String
- attack=attack.to_i
- else
- attack*=0.5 if @tolerance.include?(element)
- attack*=1.5 if @weakness.include?(element)
- attack-=@defence if !magical
- attack-=@resistance if magical
- attack=[attack.round,1].max
- end
- Info.new(ix-attack.to_s.length*7,iy-20,attack,"Damage1")
- @hp-=attack
- @inv=8
- @damaged=true
- end
- def dead
- Snd['KO'].play
- Particle.new(@x+size[0]/2,@y+size[1]/2,3,img,vx=-8+rand(17),-6-rand(7),:angle=>0,:rotate=>vx*4)
- remove
- end
- def collide
- pl.x+12>@x+@offx and pl.x-12<@x+@offx+size[0] and pl.y+20>@y+@offy and pl.y-(pl.crouch ? 8 : 40)<@y+@offy+size[1]
- end
- def preact;end
- def dam_snd;end
- def dead?;@dead;end
- end
- class Info < Entity
- def initialize(x,y,text,font)
- @x,@y,@text,@font=x,y,text,font
- @time=30
- @unstoppable=true
- init
- end
- def update
- remove if (@time-=1)==0
- @y-=1
- end
- def draw
- if @font.class==Image
- @font.draw(@x,@y,4)
- elsif @font.class==Array
- @font[$count/8%2].draw(@x,@y,4)
- @time=60 if !@timed
- @timed=true
- else
- Fnt[["System/#{@font}",14,16]].draw(@text,@x,@y,4)
- end
- end
- end
- class Room
- attr_reader :x,:y,:discovered,:dimension,:mapped
- def draw(option)
- return if !@mapped && !@discovered or @dimension && option==1 or !@dimension && option==2
- if @type>0
- color=@discovered ? [0xffff0000,0xffffff00][@type-1] : 0xff404040
- elsif @type==0
- color=(@dimension ? 0x80ff0000 : 0x800000ff) if option==0
- color=0xffc000c0 if option==0 and (room=$save[:map].find{|room| room.dimension==!@dimension and room.x==@x and room.y==@y}) && @discovered && room.discovered || !room
- color=0xff000080 if option==1
- color=0xff800000 if option==2
- color=0xff800080 if option==3
- color=0xff404040 if !@discovered
- end
- Img["System/#{@fall ? 'Fall' : 'Back'}"].draw(@x,@y,0,1,1,color)
- 4.times{|i| Img['System/Wall'].draw_rot(@x+5,@y+5,(@walls[i]==2 ? 1 : 2)*(@dimension ? 0.2 : 1),i*90,0.5,0.5,1,1,@walls[i]==2 ? 0xff008040 : @discovered ? 0xffffffff : 0xffc0c0c0) if @walls[i]>0}
- end
- def discover
- @discovered=true
- end
- def map!
- @mapped=true
- end
- def setwall(wall,value)
- @walls[wall]=value
- end
- end
- class Message
- attr_reader :closed,:guide
- def initialize(name,face,text,guide=false)
- @name,@face,@text,@guide=name,face,text,guide
- @char=0
- $game.messages << self
- end
- def draw
- @master=true if !$game.player.ignore
- $game.player.ignore=true
- Img['System/Message'].draw(0,0,4)
- if @face.class==String
- Img["Faces/#{@face}"].draw(16,16,4)
- else
- @face.draw(64,64,4)
- end
- Fnt[['System/Font',20,20]].draw(@text[(0...@char)],150,20,4,:xspacing=>15)
- Fnt[['System/Font',20,20]].draw(@name,320,0,4,:align=>:center)
- @char+=1 if @char<@text.length and $count% (Keypress[:jump] ? 1 : 4)==0
- if Keypress[:jump,false] && @char==@text.length or Keypress[:spin,false]
- $game.messages.shift
- $game.player.freeze=true
- @closed=true
- $game.player.ignore=nil if @master
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement