Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Mario < Entity
- attr_accessor :vx,:vy,:inv,:ignore,:freeze,:crouch,:wall,:antirec
- attr_reader :model,:starman
- def initialize(x,y)
- @unstoppable=true
- @x,@y=x,y
- @model=Load.Model('Mario')
- @animations={}
- [:stand,:run,:jump1,:jump2,:fall,:wallslide,:shoot,:warp,:crouch,:swim1,:swim2,:pound,:destone,:spin,:mammamia].each{|name| @animations[name]=Load.Animation(name.to_s.capitalize)}
- @vx=@vy=0
- @delay=0
- @water=($game.map.water?(@x,@y+20) or $game.map.water?(@x,@y-20))
- @model.z=1.5
- end
- def update
- @frozen=@down=@stomped=@solid=nil
- @ignore=nil if @ignore.class==Fixnum and (@ignore-=1)==0
- @peffect.init if @peffect and $game.missing(@peffect)
- if @portal
- @model.animation(@animations[:fall],:force=>true,:keep=>true)
- @model.angle+=8
- @x-=(@x<=>@portal[0])
- @y-=(@y<=>@portal[1])
- return
- end
- return @freeze=nil if @freeze
- maxspeed=($save[:equip][0]==9 ? 16 : 8)
- @inv=@inv2=nil if @inv and (@inv-=1)==0
- @delay-=1
- @delay=0 if $save[:recoil]
- $save[:recoil]=nil if $save[:recoil] and ($save[:recoil]-=1)==0
- # $save[:mp_regen].times{|i| $save[:mp]+=1 if $save[:mp]<$save[:max_mp] and @delay<=0} if $save[:status]!='CURSE'
- $save[:mp]=[$save[:mp]+$save[:mp_regen],$save[:max_mp]].min if @delay<=0 and $save[:status]!='CURSE' and ![$save[:equip][6],$save[:equip][7]].include?(9)
- $save[:mp]=[$save[:mp]-$save[:max_mp]/100,0].max if $save[:status]=='CURSE'
- $save[:stars]=[$save[:stars]+1,$save[:max_stars]].min if [$save[:equip][6],$save[:equip][7]].include?(9) and $count% ((15*(1-$save[:stars].to_f/$save[:max_stars])).to_i+1)==0
- if $save[:status]=='POISON' and $count%60==0
- Snd['MarioDamage2'].play
- $save[:hp]-=(damage=$save[:max_hp]/50)
- Info.new(@x-damage.to_s.length*7,@y-40,damage,"Damage1")
- end
- if @jump3
- @model.angle+=6
- elsif @pound
- @model.angle=@pound*18 if @pound.between?(0,19)
- @model.angle=0 if @pound==20
- elsif @wall
- @model.angle=(@wall==:left ? 270 : 90)
- else
- @model.angle=0
- end
- if @spin
- @model.mirror_x=($count%4<2)
- end
- if @warp
- @x+=[0,1,0,-1][[:up,:right,:down,:left].index(@warp[0])]
- @y+=[-2,0,2,0][[:up,:right,:down,:left].index(@warp[0])]
- @warp[1]-=1
- $game.came=[$game.player.x,$game.player.y] if @warp[1]==0 and @warp[2]
- @warp=nil if @warp[1]==0
- end
- return if @warp
- @warp2=nil if !Keypress[@warp2]
- if !@water && $game.map.water?(@x,@y+20) || @water && !$game.map.water?(@x,@y+20) and !@rewater
- @rewater=true
- elsif !@water && $game.map.water?(@x,@y+20) || @water && !$game.map.water?(@x,@y+20) and @rewater
- @vx=@vy=0 if !@water
- @spin=false
- if @water and key(:jump) || key(:spin,false)
- Snd['Jump1'].play
- @model.animation(@animations[:jump2],:force=>true,:keep=>true)
- @vy=-16
- if key(:spin)
- Snd['Spin'].play
- @spin=true
- end
- end
- @glide=@pound=@rewater=nil
- Snd['Swim'].play
- @water=!@water
- l=$game.entities[0].find{|ent| ent.class==Lava and distance(ent.x+16,ent.y+16,@x,@y)<48}
- tr=Trail.new(@x-16,@y-64,2,["effects/splash#{l ? "2" : ""}",32,32],[0,1,2,3],4)
- 64.times{if !$game.map.water?(tr.x+16,tr.y+32) then tr.y+=1 else break end}
- 64.times{if $game.map.water?(tr.x+16,tr.y+31) then tr.y-=1 else break end}
- end
- if key(:right) and !@crouch and @vx<(key(:shoot) ? maxspeed : 4)
- @vx+=(@water ? 0.2 : 0.4)
- elsif key(:left) and !@crouch and @vx>-(key(:shoot) ? maxspeed : 4)
- @vx-=(@water ? 0.2 : 0.4)
- end
- if !key(:right) && !key(:left) || @crouch or !key(:shoot) && @vx.abs>4 or @vx.abs>maxspeed
- @vx+=0.25 if @vx.round<0
- @vx-=0.25 if @vx.round>0
- end
- if @crouch and $save[:relics][3] and $game.solid?(@x-16,@y+24,:super) and !$game.solid?(@x+8,@y+24) and $game.solid?(@x+8,@y+64,:super)
- @vx+=0.5
- @slide=true
- @model.animation(@animations[:pound],:force=>:true) if @slide
- elsif @crouch and $save[:relics][3] and $game.solid?(@x+16,@y+24,:super) and !$game.solid?(@x-8,@y+24) and $game.solid?(@x-8,@y+64,:super)
- @vx-=0.5
- @slide=true
- @model.animation(@animations[:pound],:force=>:true) if @slide
- end
- @slide=@crouch=nil if @slide and !key(:down)
- if @vx.to_i>0
- @model.mirror_x=nil if !@spin
- @vx.to_i.times{if !right ; @x+=1
- 4.times{if $game.solid?(@x+14,@y+23,true) and !$game.solid?(@x+14,@y-40) ; @y-=1 ; @vx-=0.1 else break end}
- 4.times{|y| if $game.solid?(@x-14,@y+25+y,:super) and !$game.solid?(@x-14,@y+24+y) ; @y+=y ; @vx+=0.05*y; break end}
- else @vx=0 ; break end}
- if @slide ; $game.stomp(@x+8,@y,:slide) end
- elsif @vx.to_i<0
- @model.mirror_x=true if !@spin
- (-@vx).to_i.times{if !left ; @x-=1
- 4.times{if $game.solid?(@x-14,@y+23,true) and !$game.solid?(@x-14,@y-40) ; @y-=1 ; @vx+=0.1 else break end}
- 4.times{|y| if $game.solid?(@x+14,@y+25+y,:super) and !$game.solid?(@x+14,@y+24+y) ; @y+=y ; @vx-=0.05*y ; break end}
- else @vx=0 ; break end}
- if @slide ; $game.stomp(@x-8,@y,:slide) end
- end
- @vy+=(@water ? 0.5 : 1) if !@water || @vy<4 and !@pound || @pound<0 and !@wall and !@morejump
- @glide=true if !@water and @vy>1 and $save[:relics][5] && key(:up) && key(:jump)
- @vy=2 if !@jump && @glide
- if @jump3 and !@cape and $save[:relics][10] and !@pwing and key(:jump,false)
- Snd['PWing'].play
- @pwing=0
- @jump3=@jump1=@jump2=@spin=nil
- @peffect=Trail.new(@x+(@model.mirror_x ? 32 : -32),@y-44,1.4,['Effects/PWing',26,32],[0,1]*38,4,:scalex=>(@model.mirror_x ? -1 : 1))
- elsif @pwing and @pwing<300
- @model.animation(@animations[:jump2],:force=>true,:keep=>true)
- @pwing+=1
- Snd['PWing'].play if @pwing%60==0
- @vy=-(2+@pwing*0.05)
- @peffect.x=@x+(@model.mirror_x ? 32 : -32)
- @peffect.y=@y-44
- @peffect.args[:scalex]=(@model.mirror_x ? -1 : 1)
- @pwing=300 if !key(:jump)
- elsif @pwing
- @peffect.remove
- @pwing=@peffect=nil
- end
- if @vy>0
- @vy.to_i.times{if !down ; @y+=1
- $game.stomp(@x,@y,@spin ? :spin : @pound) if !@water
- break if @stomped
- else @vy=0
- @cape=nil
- if @pound and @pound>0
- $game.pow(@x-18,@y+32,36,true)
- Snd['Butt'].play
- 9.times{|i| Trace.new(@x-12,@y+12,2,'effects/butt',16,:movex=>offset_x(280+i*20,2),:movey=>offset_y(280+i*20,2))}
- @pound=-30
- end
- break end}
- elsif @vy<0
- @vy.to_i.abs.times{if !up ; @y-=1 else $game.pow(@x-18,@y-40,36,false) ; @vy=0 ; @wall=@model.mirror_y=nil ; break end}
- end
- @poubd=nil if @vy.to_i<1
- dn=(@wall ? @wall==:left ? left : right : down)
- dn2=down(true)
- if Keypress[:down,false] and $save[:relics][2] and !@pound and !@water and !@slide and !@crouch and !dn
- @pound=0
- @spin=@crouch=nil
- @vy=@vx=0
- elsif @pound
- @model.animation(@animations[:pound],:force=>:true)
- @pound+=1
- @vy=16 if @pound==20
- @pound=nil if @pound==0
- end
- return if @mammamia
- if @water
- Trail.new(@x-4,@y-30,3,'effects/bubble',:bubble,0) if rand(60)==0 and $game.map.water?(@x,@y-20)
- if @vy>0 and !dn
- @model.animation(@animations[:swim1],:force=>true)
- elsif @vy<0
- @model.animation(@animations[:swim2],:force=>true)
- elsif dn
- if @vx.to_i !=0
- @model.animation(@animations[:run],:force=>true)
- else
- @model.animation(@animations[:stand],:force=>true)
- end
- end
- elsif !@pound and !@spin and !@slide
- if dn and key(:down)
- @model.animation(@animations[:crouch],:force=>true,:keep=>true)
- @crouch||=0
- elsif dn and @vx.to_i !=0 || @wall
- @model.animation(@animations[:run],:force=>true)
- elsif dn
- @model.animation(@animations[:stand],:force=>true)
- elsif @vy>0
- @model.animation(@animations[:fall],:force=>true,:keep=>true)
- end
- @crouch=nil if !key(:down)
- elsif !@pound and !@slide
- @model.animation(@animations[:spin],:force=>:true)
- end
- jumph=($save[:equip][0]==4 ? 4 : $save[:equip][0]==2 ? -4 : 0)
- if !@water and $save[:relics][6] and !dn and @vy>0 and key(:left) && $game.solid?(@x-16,@y-32) || key(:right) && $game.solid?(@x+16,@y-32) and !$game.entities[1].find{|e| e.class==Spikes and !e.harmless and e.collide}
- @vy=0
- @wallslide=true
- @model.animation(@animations[:wallslide],:force=>true)
- @jump1=@jump2=@jump3=@spin=nil
- Trail.new(@x+(@model.mirror_x ? -30 : 8),@y-48,2.2,['Effects/Slide',22,20],[2,1,0],6) if $count%12==0
- if key(:jump,false)
- jump
- Snd['Jump1'].play
- @vx=(@model.mirror_x ? 10 : -10)
- @jump1=@jump2=@jump3=@spin=nil
- @vy=-20-jumph
- @model.animation(@animations[:jump1],:force=>true)
- end
- else
- @wallslide=nil
- end
- if @water
- if key(:jump,false)
- Snd['Swim'].play
- @vy=-8
- end
- else
- @spec_jump=0 if key(:jump,false)
- @spec_jump+=1 if @spec_jump
- @spec_jump=nil if @spec_jump==15 or !key(:jump)
- if key(:jump,false) and !@jump1 and dn and !@wall and !@slide
- Snd['Jump'].play
- Snd['Jump1'].play
- @vy=-8-@vx.abs-jumph
- @morejump=(-12-maxspeed-jumph)-@vy
- @morejump+=[@morejump+6+jumph,0].min
- @spec_jump=nil
- @jump1=@jump=true
- @model.animation(@animations[:jump1],:force=>true)
- jump
- elsif @spec_jump || @bouncing and @jump1 and !@jump2 and @vx.abs>3 and dn2
- Snd['Jump'].play
- Snd['Jump2'].play
- @vy=-25-jumph
- @jump2=@jump=true
- @spec_jump=nil
- @model.animation(@animations[:jump2],:force=>true)
- jump
- elsif @spec_jump || @bouncing and @jump2 and !@jump3 and @vx.abs>7 and dn2
- Snd['Jump'].play
- Snd['Jump3'].play
- @vy=-30-jumph
- @jump3=@jump=true
- jump
- elsif dn
- @jump1=@jump2=@jump3=@spin=nil
- end
- @jump=@bouncing=@glide=nil if !key(:jump)
- @jump1=nil if !$save[:relics][0]
- @jump2=nil if !$save[:relics][1]
- @bouncing=true if key(:jump,false) and @vy>0 and [30,40,50,60,70].find{|y| $game.solid?(@x,@y+y,:super)}
- if key(:spin,false) and $save[:relics][11] and dn and !@wall
- jump
- Snd['Jump'].play
- Snd['Spin'].play
- @spin=true
- @vy=-8-@vx.abs-jumph
- @morejump=(-12-maxspeed-jumph)-@vy
- @morejump+=[@morejump+6+jumph,0].min
- end
- end
- if @wall
- @wallfx||=0
- @wallfx2=Trail.new(@x+(@wall==:left ? 12 : 0),@y+4,1.4,['Effects/Cape',32,32],[0,1,2,1],4,:scalex=>(@wall==:right ? -1 : 1)) if @wallfx%19==0
- @wallfx2.y=@y+4
- @wallfx+=1
- @model.mirror_x=true
- @model.mirror_y=(@wall==:right)
- if !key(@wall) or @wall==:left && !left or @wall==:right && !right
- @vx=(@wall==:left ? -4 : 4)
- @wallfx2.remove
- @model.mirror_y=@wall=@wallfx=@wallfx2=nil
- elsif Keypress[:jump,false]
- jump
- Snd['Jump'].play
- Snd['Jump3'].play
- @jump1=@jump2=@jump3=true
- @cape=true
- @vy=-18
- @vx=(@wall==:left ? 12 : -12)
- @wallfx2.remove
- @model.mirror_y=@wall=@wallfx=@wallfx2=nil
- end
- end
- if @glide and !dn
- @glidefx||=0
- @glidefx2=Trail.new(@x+(@model.mirror_x ? 8 : -8),@y-24,1.4,['Effects/Tail',33,36],[0,1,2,3,4,5,4,3,2,1],2,:scalex=>(@model.mirror_x ? 1 : -1),:unstop=>true) if @glidefx%28==0
- @glidefx2.y=@y-24
- @glidefx2.x=@x+(@model.mirror_x ? 8 : -8)
- @glidefx+=1
- else
- @glidefx2.remove if @glidefx2
- @glidefx=@glidefx2=nil
- end
- if !@wall and key(:shoot,false) and !key(:up)
- shoot(false,$save[:equip][1]) if $save[:equip][1]
- elsif !@wall and key(:shoot,false)
- shoot(true,$save[:equip][2]) if $save[:equip][2]
- end
- if $save[:equip][0]==7 and $count%30==0 and $save[:hp]< $save[:max_hp]
- heal=[$save[:max_hp]/300+1,$save[:max_hp]-$save[:hp]].min
- Info.new(@x-7,@y-40,"+#{heal}","Damage2")
- $save[:hp]+=heal
- end
- @firebar=nil if @firebar and (@firebar[1]-=1)==0
- if @firebar
- @firebar[3]||=(@model.mirror_x ? 270 : 90) if $save[:magic][5][1]==5 and @firebar[0]==10 and Keypress[:shoot]
- @firebar[3]+=(@model.mirror_x ? -8 : 8) if @firebar[3]
- angle=(@firebar[3] ? @firebar[3] : (@model.mirror_x ? 270 : 90))
- @firebar[2].each{|bar| dist=(@firebar[2].index(bar)+1)*16 ; bar.x=@x-8+offset_x(angle,dist) ; bar.y=@y-(@crouch ? 8 : 24)+offset_y(angle,dist)}
- if @firebar[3] and Keypress[:shoot]
- @firebar[1]=15
- @firebar[2].each{|bar| bar.args[:repeat]=15; bar.init if $game.missing(bar)}
- end
- if @firebar[3] and $save[:mp]>1
- $save[:mp]-=2
- elsif @firebar[3]
- @firebar=nil
- end
- end
- if @poisonball and $save[:mp]>=[40-@poisonball/5,1].max and Keypress[:shoot]
- @poisonball+=1
- return @poisonball=nil if @poisonball==0 and !@poisonball2
- @delay=120
- if @poisonball>0 and @poisonball%5==0
- @model.animation(@animations[:shoot],:force=>true,:solid=>true,:repeat=>true)
- $save[:mp]-=[40-@poisonball/5,1].max
- Snd['Fireball'].play
- Projectile.new(@x-8,@y-8,2,'Projectiles/Poisonball',[16,16],60+$save[:intelligence],:vx=>@model.mirror_x ? -6-rand(7) : 6+rand(7),:bounce=>-6,:angle=>0,:rotate=>@model.mirror_x ? -10-rand(20) : 10+rand(20),:element=>8,:wallbounce=>0,:fx=>1,:remove2=>[-4,-4,'Effects/Poison',16],:id=>2)
- end
- elsif @poisonball and !Keypress[:shoot] and !@poisonball2
- @poisonball2=15
- elsif @poisonball and !Keypress[:shoot] and @poisonball2>0
- @poisonball2-=1
- elsif @poisonball
- @poisonball=@poisonball2=nil
- end
- if @sword
- @model.mirror_x=@sword[1]
- @sword[0].x=@x+(@model.mirror_x ? -([76,118,160,188][$save[:magic][8][1]]) : 16)
- @sword[0].y=@y-[40,61,103,131][$save[:magic][8][1]]
- @sword=nil if $game.missing(@sword[0])
- end
- @blast=@blast2=nil if @blast and (@blast-=1)==0##$game.missing(@blast)
- if $save[:equip][2]==11
- return if @reload and (@reload-=1)>0
- if key(:up)
- @aim||=180
- @aim+=(key(:down) ? 1 : 2)*(@model.mirror_x ? 1 : -1) if @aim>0
- else
- @aim=@reload=nil
- end
- end
- @boomerang=nil if @boomerang and $game.missing(@boomerang)
- if @rotodisc
- @rotodisc[0].init if $game.missing(@rotodisc[0])
- @rotodisc[0].x=@x-16+offset_x(@rotodisc[1],128)
- @rotodisc[0].y=@y-16+offset_y(@rotodisc[1],128)
- @rotodisc[1]+=4
- if $save[:stars]<1 or $save[:equip][2] != 8
- @rotodisc[0].remove
- @rotodisc=nil
- end
- $save[:stars]-=1 if @rotodisc and @rotodisc[1]%80==0
- end
- if @rainbow and Keypress[:shoot] and $save[:mp]>0
- level=$save[:magic][11][1]
- attack=set_att(11)
- $save[:mp]-=(level==4 ? 1 : 2)
- angle=angle(@x,@y,@rainbow[0],@rainbow[1])
- Projectile.new(@x-16,@y-16,0,'Projectiles/Rainbow',[32,32],attack,:through=>(level==4),:z=>1.4,:repeat=>(60+level*30),:id=>11,:angle=>angle,:mirror_x=>(angle>=180 ? true : false)) if @rainbow[0] != @x or @rainbow[1] != @y
- @rainbow=[@x,@y]
- @delay=6
- elsif @rainbow
- @rainbow=nil
- end
- if @noob
- @noob+=1
- list=[]
- $game.entities[1].each{|ent| list << ent if ent.respond_to?(:damage) and !ent.dead? and distance(ent.x+ent.size[0]/2,ent.y+ent.size[1]/2,@x,@y)<=320}
- list.sample.damage((1+@noob/600).to_s,nil,nil) if !list.empty?
- @noob=nil if !Keypress[:shoot]
- end
- if @starman
- @inv=1
- Projectile.new(@x-15,@y-14,0,'Projectiles/Starman',[30,38],$save[:strength]+100,:through=>true,:setinv=>1)
- @starman=Snd["Starman"].play if !@starman.playing?
- $save[:stars]-=1 if $count%2==0
- if $save[:stars]==0
- @starman.stop
- @starman=nil
- end
- end
- if @charge and Keypress[:shoot]
- @charge+=1
- 8.times{|i| Trail.new(@x+offset_x(i*45,64),@y+offset_y(i*45,64),3,['Effects/ChaosF',11,11,0],(0..7).to_a.shuffle,4,:movex=>-offset_x(i*45,@charge<60 ? 1 : -1),:movey=>-offset_y(i*45,@charge<60 ? 1 : -1),:unstop=>true)} if @charge%24==0
- Snd['Bowsa'].play if @charge==60
- elsif @charge
- if @charge>=60
- attack=120
- id=14
- Snd['Fireball'].play
- Projectile.new(@x-8,@y-8,2,'Projectiles/Fireball2',[17,17],attack+$save[:intelligence],:vy=>-6,:vx=>@model.mirror_x ? -6 : 6,:bounce=>-9,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>3,:wallbounce=>0,:fx=>1,:id=>id,:trail=>[4,'Projectiles/Fireball2 Trail',15,15,3,2],:remove=>[-16,-16,'Effects/Fireball Trail',48,48,4])
- Snd['Fireball2'].play
- Projectile.new(@x-8,@y-8,2,'Projectiles/Iceball',[16,16],attack+$save[:intelligence],:vy=>-12,:vx=>@model.mirror_x ? -4 : 4,:bounce=>-11,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>4,:wallbounce=>0,:fx=>1,:trail=>[4,'Projectiles/Iceball Trail',16,16,3,2],:remove=>[-16,-16,'Effects/Iceball Trail',48,48,4],:id=>id)
- Snd['Fireball'].play
- Projectile.new(@x-8,@y-8,2,'Projectiles/Poisonball',[16,16],attack+$save[:intelligence],:vy=>-6,:vx=>@model.mirror_x ? -6 : 6,:bounce=>-6,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>8,:wallbounce=>0,:fx=>1,:remove2=>[-4,-4,'Effects/Poison',16],:id=>id)
- Snd['Darkball'].play
- Projectile.new(@x-16,@y-16,2,'Projectiles/Darkball',[33,33],attack+$save[:intelligence],:vy=>-6,:vx=>@model.mirror_x ? -1-3-rand(8) : 1+3+rand(8),:bounce=>-3-rand(15),:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>9,:wallbounce=>0,:fx=>1,:trail=>[4,'Projectiles/Darkball Trail',15,15,3,2],:remove2=>[4,4,'Effects/Curse',16],:id=>id)
- Snd['TCharge'].play
- Projectile.new(@x-8,@y-8,2,'Projectiles/Boltball',[16,16],attack+$save[:intelligence],:vy=>-4,:vx=>@model.mirror_x ? -10 : 10,:bounce=>-8,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>5,:wallbounce=>0,:through=>true,:fx=>1,:trail=>[4,'Projectiles/Boltball Trail',16,16,3,2],:remove=>[-16,-16,'Effects/Boltball Trail',48,48,4],:id=>id)
- Snd['Priest'].play
- Projectile.new(@x-16,@y-16,3,'Projectiles/Lightball',[32,32],attack+$save[:intelligence],:speed=>9,:dir=>@model.mirror_x ? 270 : 90,:rotate=>@model.mirror_x ? -10 : 10,:element=>7,:trace=>[true,1,24],:id=>id,:z=>3,:remove=>[-8,-8,'Effects/Lightball Trail',48,48,4])
- Snd['Darkball'].play
- Projectile.new(@x-14,@y-14,2,'Projectiles/Shadeball',[28,28],attack+$save[:intelligence],:vy=>-2,:vx=>@model.mirror_x ? -8 : 8,:bounce=>-12,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>6,:wallbounce=>0,:fx=>1,:id=>id,:trace=>[true,1,24],:remove=>[-16,-16,'Effects/Shadeball Trail',48,48,4],:antigrav=>true)
- Snd['Stoneball'].play
- Projectile.new(@x-8,@y-8,2,'Projectiles/Stoneball',[16,16],attack+$save[:intelligence],:vy=>-6,:vx=>@model.mirror_x ? -6 : 6,:bounce=>0,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>10,:wallbounce=>0,:fx=>1,:id=>id,:trail=>[4,'Projectiles/Stoneball Trail',15,15,3,2],:remove=>[-5,-4,'Effects/Stoneball Trail',22,20,4])
- end
- @charge=nil
- end
- end
- def draw
- @model.skin=['Mario','Koopa','Metal','Wario','Luigi','Boo','Fire','Life','Magic','Athlete','Ice','Thor','Shadow'][$save[:equip][0]]
- if $save[:equip][0]==11 && @last != 11 or @last==11 && $save[:equip][0]!=11
- @last=$save[:equip][0]
- a=@model.order[4]
- @model.order[4]=@model.order[6]
- @model.order[6]=a
- a=@model.order[5]
- @model.order[5]=@model.order[7]
- @model.order[7]=a
- end
- @model.animation(Keypress[:jump] ? @animations[:destone] : @animations[:stand],:force=>true) if $save[:status]=='STONE'
- @crouch+=1 if @crouch and @crouch<10
- if $save[:status] != 'GOOD'
- @status ||= 600
- @status-=1 if $save[:status] != 'STONE'
- $save[:status]='GOOD' if @status<=0
- else
- @status=nil
- end
- if $save[:status]=='STONE' and Keypress[:jump,false]
- @status-=60
- Snd[@status==0 ? 'Bricks' : 'Stone'].play
- end
- if @aim
- # dir=(@model.mirror_x ? -48 : 48)
- dir=48
- x=@x+offset_x(@aim,dir) ; y=@y+offset_y(@aim,dir)
- Img['Enemies/SK Crosshair'].draw_rot(x,y,3,0)
- Img['Enemies/SK Gun'].draw_rot(@x,@y,3,angle(@x,@y,x,y))
- $screen.draw_line(@x,@y,0xffff0000,@x+offset_x(@aim,dir*15),@y+offset_y(@aim,dir*15),0x00000000,3)
- end
- @model.x=@x+(@wall ? @wall==:left ? 6 : -5 : @wallslide ? @model.mirror_x ? 5 : -4 : 0) if !@frozen
- @model.y=@y-5+(@crouch ? [6,6,7,8,8,9,9,10,11,12,13][@crouch] : 7)+(@pound ? 22 : 0)+(@slide ? 14 : 0)+(@warp ? 8 : 0) if !@frozen
- @model.update if !@frozen
- return if @inv and !@inv2 and $count%3==0
- if @starman
- $shaders[4].enable(1.5)
- else
- $shaders[0].enable(1.5) if $save[:status]=='STONE'
- $shaders[1].enable(1.5) if $save[:status]=='CURSE'
- $shaders[2].enable(1.5) if $save[:status]=='POISON'
- $shaders[3].enable(1.5) if $save[:status]=='PROTEC'
- end
- @model.draw
- if @starman
- $shaders[4].disable(1.5)
- else
- $shaders[0].disable(1.5) if $save[:status]=='STONE'
- $shaders[1].disable(1.5) if $save[:status]=='CURSE'
- $shaders[2].disable(1.5) if $save[:status]=='POISON'
- $shaders[3].disable(1.5) if $save[:status]=='PROTEC'
- end
- Tls['System/Status',48,16][['POISON','CURSE','STONE',nil,'PROTEC'].index($save[:status])].draw(@x-24,@y-64,4,1,1,(@status>60 or $count%8<4) ? 0xffffffff : 0x80ffffff) if $save[:status] != 'GOOD'
- @morejump=nil if @morejump and (@morejump+=1)>=0 || !key(:jump) && !@spin && !key(:spin)
- @frozen=true
- @solid=($save[:equip][0]==1)
- end
- def bounce
- @inv=8
- return if @pound or @slide
- jump
- @model.animation(@animations[:jump1],:force=>true) if !@slide
- @vy=-(($save[:relics][7] and @spin && key(:spin) || !@spin && key(:jump)) ? 20 : 10)
- @inv2=true if @inv==8
- @stomped=true
- end
- def down(spec=false)
- $down=self
- 5.times{|x| ($down=nil;return true) if $game.solid?(@x-14+x*7,@y+24,spec ? :super : true)}
- false
- end
- def down?
- @down||=down
- @down
- end
- def up
- 5.times{|x| return true if $game.solid?(@x-14+x*7,@y-40)}
- false
- end
- def right
- 9.times{|y| return true if $game.solid?(@x+15,[@y-36+y*7,@y+19].min)}
- false
- end
- def left
- 9.times{|y| return true if $game.solid?(@x-15,[@y-36+y*7,@y+19].min)}
- false
- end
- def dir;@model.mirror_x ? :left : :right;end
- def shoot(weapon,id)
- if !weapon
- return if $save[:mp]<$items[:magic][id][:use]
- $save[:mp]-=$items[:magic][id][:use]
- @model.animation(@animations[:shoot],:force=>true,:override=>true,:repeat=>true)
- @delay=$items[:magic][id][:recoil].to_f*60
- @delay*=0.5 if $save[:equip][6]==5
- @delay*=0.25 if $save[:equip][6]==7
- @delay-=[($save[:mp_regen]-1)*6,0].max
- level=$save[:magic][id][1]
- case id
- when 0
- Snd['Fireball'].play
- attack=set_att(0)
- if level==2
- Projectile.new(@x-8,@y-8,2,'Projectiles/Fireball2',[17,17],attack+$save[:intelligence],:vy=>-6,:vx=>@model.mirror_x ? -6 : 6,:bounce=>-9,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>3,:wallbounce=>0,:fx=>1,:id=>id,:trail=>[4,'Projectiles/Fireball2 Trail',15,15,3,2],:remove=>[-16,-16,'Effects/Fireball Trail',48,48,4])
- else
- Projectile.new(@x-8,@y-8,2,'Projectiles/Fireball',[16,16],attack+$save[:intelligence],:vy=>-6,:vx=>@model.mirror_x ? -6 : 6,:bounce=>-9,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>3,:wallbounce=>0,:fx=>1,:remove2=>[-4,-4,'Effects/Fireball Trace',16],:id=>id)
- end
- when 1
- Snd['Fireball2'].play
- attack=set_att(1)
- Projectile.new(@x-8,@y-8,2,'Projectiles/Iceball',[16,16],attack+$save[:intelligence],:vy=>-6,:vx=>@model.mirror_x ? -4 : 4,:bounce=>-11,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>4,:wallbounce=>0,:fx=>1,:trail=>[4,'Projectiles/Iceball Trail',16,16,3,2],:remove=>[-16,-16,'Effects/Iceball Trail',48,48,4],:id=>id)
- Projectile.new(@x-8,@y-8,2,'Projectiles/Iceball',[16,16],attack-5+$save[:intelligence],:vy=>-12,:vx=>@model.mirror_x ? -4 : 4,:bounce=>-9,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>4,:wallbounce=>0,:fx=>1,:trail=>[4,'Projectiles/Iceball Trail',16,16,3,2],:remove=>[-16,-16,'Effects/Iceball Trail',48,48,4],:id=>id) if level==2
- when 2
- Snd['Fireball'].play
- attack=set_att(2)
- Projectile.new(@x-8,@y-8,2,'Projectiles/Poisonball',[16,16],attack+$save[:intelligence],:vy=>-6,:vx=>@model.mirror_x ? -6 : 6,:bounce=>-6,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>8,:wallbounce=>0,:fx=>1,:remove2=>[-4,-4,'Effects/Poison',16],:id=>id)
- @poisonball||=-15 if level==2
- when 3
- # Projectile.new(@x-40,@y-40,0,'Projectiles/TCharge',[80,80],120+$save[:intelligence],:harmless=>true,:spec1=>true,:targetx=>@x+(@model.mirror_x ? -120 : 40),:targety=>@y-264,:id=>id,:notoffmap=>true)
- if !@_thunder or @_thunder.removed or $game.missing(@_thunder)
- return $save[:mp]+=$items[:magic][id][:use] if @_thunderwait and $count-@_thunderwait<80
- @_thunder=Projectile.new(@x+(@model.mirror_x ? -120 : 40),@y-264,0,'Projectiles/TCharge',[80,80],120+$save[:intelligence],:harmless=>true,:spec1=>true,:id=>id,:notoffmap=>true)
- elsif @_thunder and level>0
- @_thunder.instance_variable_set(:@wait,1)
- @_thunder.args[:spec1a]=(@model.mirror_x ? -4 : 4) if level==3
- @_thunderwait=$count if level==1
- else
- $save[:mp]+=$items[:magic][id][:use]
- end
- when 4
- attack=set_att(4)
- Snd['Darkball'].play
- Projectile.new(@x-16,@y-16,2,'Projectiles/Darkball',[33,33],attack+$save[:intelligence],:vy=>-6,:vx=>@model.mirror_x ? -1-level-rand(8) : 1+level+rand(8),:bounce=>-level-rand(15),:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>9,:wallbounce=>0,:fx=>1,:trail=>[4,'Projectiles/Darkball Trail',15,15,3,2],:remove2=>[4,4,'Effects/Curse',16],:id=>id)
- when 5
- @firebar||=[0,60,[],nil]
- if @firebar[0]<level+5
- Snd['Fireball'].play
- @firebar[0]+=1
- _time=60+level*20
- @firebar[1]=_time
- @firebar[2].each{|bar| bar.args[:repeat]=_time; bar.init if $game.missing(bar)}
- @firebar[2]<<Projectile.new(@x-8+@firebar[0]*(@model.mirror_x ? -16 : 16),@y-24,0,'Projectiles/Fireball',[16,16],50+$save[:intelligence],:angle=>0,:rotate=>@model.mirror_x ? -16 : 16,:element=>3,:repeat=>_time,:through=>true,:notoffmap=>true,:z=>3,:id=>id)
- else
- $save[:mp]+=20
- end
- when 6
- Snd['KO'].play
- Projectile.new(@x,@y-32,2,['Projectiles/Goombavenger',32,32,0],[32,32],$items[:magic][6][:attack]+$save[:intelligence],:vx=>@model.mirror_x ? -4 : 4,:vy=>-4,:stop=>true,:animation=>[2,8],:through=>true,:wallbounce=>(level==1 ? 3 : 1),:fx=>0,:climb=>2,:id=>id)
- when 7
- Snd['KO'].play
- attack=set_att(7)
- Projectile.new(@x-10,@y-32,3,'Projectiles/Reboundst2',[20,18],attack+$save[:intelligence]/8,:dir=>(@model.mirror_x ? 225 : 135),:speed=>8+level,:bounce=>4+level,:through=>true,:line=>true,:id=>id)
- when 8
- return $save[:mp]+=100 if @sword
- attack=set_att(8)
- Snd['Sword'].play
- if level==0
- @sword=[Projectile.new(@x+(@model.mirror_x ? -76 : 16),@y-40,0,'Projectiles/Astral1',[60,60],attack+$save[:intelligence],:repeat=>16,:dir=>(@model.mirror_x ? 315 : 45),:rotate=>@model.mirror_x ? -8 : 8,:through=>true,:origin=>[(@model.mirror_x ? 60 : 0),30,0.5,0.88],:id=>id,:mirror_x=>@model.mirror_x,:element=>7),@model.mirror_x]
- elsif level==1
- @sword=[Projectile.new(@x+(@model.mirror_x ? -118 : 16),@y-61,0,'Projectiles/Astral2',[102,102],attack+$save[:intelligence],:repeat=>32,:dir=>(@model.mirror_x ? 315 : 45),:rotate=>@model.mirror_x ? -8 : 8,:through=>true,:origin=>[(@model.mirror_x ? 102 : 0),51,0.5,0.92],:id=>id,:mirror_x=>@model.mirror_x,:element=>7),@model.mirror_x]
- elsif level==2
- @sword=[Projectile.new(@x+(@model.mirror_x ? -160 : 16),@y-103,0,'Projectiles/Astral3',[140,140],attack+$save[:intelligence],:repeat=>32,:dir=>(@model.mirror_x ? 315 : 45),:rotate=>@model.mirror_x ? -8 : 8,:through=>true,:origin=>[(@model.mirror_x ? 144 : 0),72,0.5,0.93],:id=>id,:mirror_x=>@model.mirror_x,:element=>7),@model.mirror_x]
- elsif level==3
- @sword=[Projectile.new(@x+(@model.mirror_x ? -188 : 16),@y-131,0,['Projectiles/Astral4',72,172,0],[172,172],attack+$save[:intelligence],:animation=>[5,4],:repeat=>2,:dir=>(@model.mirror_x ? 315 : 45),:rotate=>@model.mirror_x ? -4 : 4,:through=>true,:origin=>[(@model.mirror_x ? 172 : 0),120,0.5,0.9],:id=>id,:mirror_x=>@model.mirror_x,:element=>7,:unstoppable=>true),@model.mirror_x]
- end
- when 9
- Snd['KO'].play
- attack=set_att(9)
- Projectile.new(@x-8,@y-8,2,['Projectiles/Beet',27,32,0],[27,32],attack+$save[:intelligence],:sequence=>[0,1,2,1],:animation=>[4,4],:vy=>-12,:vx=>@model.mirror_x ? -4 : 4,:bounce=>-9,:angle=>0,:element=>0,:fx=>1,:id=>id,:back=>3+level,:through=>true,:bouncenemy=>true,:z=>3,:pow=>true,:superbeet=>(level==3))
- when 10
- return $save[:mp]+=25 if @blast2 and @blast2[1]>0
- attack=set_att(10)
- Snd['Blast'].play
- if !@blast
- @blast=60
- @blast2=[0,level>0 ? 0 : 60]
- elsif @blast2[0]<level
- @blast2[0]+=1
- @blast2[1]=60 if @blast2[0]==level
- end
- dx=(@model.mirror_x ? -58 : 16)+[0,8,12,4,8][@blast2[0]]*(@model.mirror_x ? -1 : 1)
- dy=-32+[0,12,-4,-16,8][@blast2[0]]
- scale=(level==4 ? 2 : level>1 ? 1.5 : 1)
- Projectile.new(@x+dx-(scale>1 ? 42.0/(scale+1) : 0),@y+dy-(scale>1 ? 40.0/(scale+1) : 0),0,['Projectiles/Blast',42,40,0],[42*scale,40*scale],attack+$save[:intelligence]/(3.0/4),:animation=>[4,4],:through=>true,:id=>id,:angle=>0,:scale=>scale,:movex=>(level==4 ? @model.mirror_x ? -1 : 1 : 0),:movey=>(level==4 ? (-1+@blast[0]%3) : 0))
- when 11
- @rainbow=[@x,@y]
- when 12
- @noob=0
- when 13
- Snd['Magi'].play
- attack=set_att(13)
- select=nil
- targets=[]
- $game.entities[1].each{|enemy| targets << enemy if enemy.class != Projectile and enemy.class != Spikes and !enemy.dead? and dir==:left && enemy.x+enemy.size[0]<@x || dir==:right && enemy.x>@x and enemy.x+enemy.size[0]>$game.scx and enemy.x<$game.scx+640 and enemy.y+enemy.size[1]>$game.scy and enemy.y<$game.scy+480}
- if !targets.empty?
- distances={}
- targets.each{|target| distances[distance(@x,@y,target.x+target.size[0]/2,target.y+target.size[1]/2)]=target}
- select=distances[distances.keys.min]
- end
- if select and level==4
- Projectile.new(@x-8,@y-24,1,['Projectiles/Magi',32,32,0],[32,32],attack+$save[:intelligence],:rotate=>(dir==:left ? -8 : 8),:dir=>(select ? angle(@x,@y,select.x+select.size[0]/2,select.y+select.size[1]/2) : dir==:left ? 270 : 90),:speed=>8+level,:id=>id,:through=>level+1,:z=>3,:magic=>true,:target=>select,:limit=>60,:setinv=>30)
- else
- Projectile.new(@x-8,@y-24,3,['Projectiles/Magi',32,32,0],[32,32],attack+$save[:intelligence],:rotate=>(dir==:left ? -8 : 8),:dir=>(select ? angle(@x,@y,select.x+select.size[0]/2,select.y+select.size[1]/2) : dir==:left ? 270 : 90),:speed=>8+level,:id=>id,:through=>level+1,:z=>3,:magic=>true,:setinv=>30)
- end
- when 14
- proj=rand([level+1,8].min)
- attack=set_att(14)
- case proj
- when 0
- Snd['TCharge'].play
- Projectile.new(@x-8,@y-8,2,'Projectiles/Boltball',[16,16],attack+$save[:intelligence],:vy=>-4,:vx=>@model.mirror_x ? -10 : 10,:bounce=>-8,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>5,:wallbounce=>0,:through=>true,:fx=>1,:trail=>[4,'Projectiles/Boltball Trail',16,16,3,2],:remove=>[-16,-16,'Effects/Boltball Trail',48,48,4],:id=>id)
- when 1
- Snd['Darkball'].play
- Projectile.new(@x-14,@y-14,2,'Projectiles/Shadeball',[28,28],attack+$save[:intelligence],:vy=>-2,:vx=>@model.mirror_x ? -8 : 8,:bounce=>-12,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>6,:wallbounce=>0,:fx=>1,:id=>id,:trace=>[true,1,24],:remove=>[-16,-16,'Effects/Shadeball Trail',48,48,4],:antigrav=>true)
- when 2
- Snd['Stoneball'].play
- Projectile.new(@x-8,@y-8,2,'Projectiles/Stoneball',[16,16],attack+$save[:intelligence],:vy=>-6,:vx=>@model.mirror_x ? -6 : 6,:bounce=>0,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>10,:wallbounce=>0,:fx=>1,:id=>id,:trail=>[4,'Projectiles/Stoneball Trail',15,15,3,2],:remove=>[-5,-4,'Effects/Stoneball Trail',22,20,4])
- when 3
- Snd['Fireball'].play
- Projectile.new(@x-8,@y-8,2,'Projectiles/Fireball2',[17,17],attack+$save[:intelligence],:vy=>-6,:vx=>@model.mirror_x ? -6 : 6,:bounce=>-9,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>3,:wallbounce=>0,:fx=>1,:id=>id,:trail=>[4,'Projectiles/Fireball2 Trail',15,15,3,2],:remove=>[-16,-16,'Effects/Fireball Trail',48,48,4])
- when 4
- Snd['Fireball2'].play
- Projectile.new(@x-8,@y-8,2,'Projectiles/Iceball',[16,16],attack+$save[:intelligence],:vy=>-12,:vx=>@model.mirror_x ? -4 : 4,:bounce=>-11,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>4,:wallbounce=>0,:fx=>1,:trail=>[4,'Projectiles/Iceball Trail',16,16,3,2],:remove=>[-16,-16,'Effects/Iceball Trail',48,48,4],:id=>id)
- when 5
- Snd['Fireball'].play
- Projectile.new(@x-8,@y-8,2,'Projectiles/Poisonball',[16,16],attack+$save[:intelligence],:vy=>-6,:vx=>@model.mirror_x ? -6 : 6,:bounce=>-6,:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>8,:wallbounce=>0,:fx=>1,:remove2=>[-4,-4,'Effects/Poison',16],:id=>id)
- when 6
- Snd['Darkball'].play
- Projectile.new(@x-16,@y-16,2,'Projectiles/Darkball',[33,33],attack+$save[:intelligence],:vy=>-6,:vx=>@model.mirror_x ? -1-3-rand(8) : 1+3+rand(8),:bounce=>-3-rand(15),:angle=>0,:rotate=>@model.mirror_x ? -10 : 10,:element=>9,:wallbounce=>0,:fx=>1,:trail=>[4,'Projectiles/Darkball Trail',15,15,3,2],:remove2=>[4,4,'Effects/Curse',16],:id=>id)
- when 7
- Snd['Priest'].play
- Projectile.new(@x-8,@y-16,3,'Projectiles/Lightball',[32,32],attack+$save[:intelligence],:speed=>9,:dir=>@model.mirror_x ? 270 : 90,:rotate=>@model.mirror_x ? -10 : 10,:element=>7,:trace=>[true,1,24],:id=>id,:z=>3,:remove=>[-8,-8,'Effects/Lightball Trail',48,48,4])
- end
- @charge=0 if level==9
- end
- else
- return if $items[:weapon][id][:use].class != String and $save[:stars]<$items[:weapon][id][:use]/([$save[:equip][6],$save[:equip][7]].include?(8) ? 2 : 1)
- $save[:stars]-=$items[:weapon][id][:use]/([$save[:equip][6],$save[:equip][7]].include?(8) ? 2 : 1) if $items[:weapon][id][:use].class != String
- @model.animation(@animations[:shoot],:force=>true,:override=>true,:repeat=>true)
- case id
- when 0
- Snd['KO'].play
- Projectile.new(@x,@y-32,2,['Projectiles/Green Shell',32,32,0],[32,32],10+$save[:strength],:vx=>@model.mirror_x ? -10 : 10,:vy=>-4,:stop=>true,:element=>0,:animation=>[3,4],:through=>true,:wallbounce=>3,:fx=>0)
- when 1
- Snd['KO'].play
- Projectile.new(@x,@y-32,2,['Projectiles/Yellow Shell',32,32,0],[32,32],25+$save[:strength],:vx=>@model.mirror_x ? -10 : 10,:vy=>-4,:element=>0,:animation=>[3,4],:through=>true,:wallbounce=>3,:fx=>0,:bounce=>-12)
- when 2
- Snd['Hammer'].play
- Projectile.new(@x-16,@y-32,2,'Projectiles/Hammer',[32,32],40+$save[:strength],:vx=>@model.mirror_x ? -5 : 5,:vy=>-15,:element=>0,:angle=>0,:rotate=>@model.mirror_x ? -15 : 15,:z=>2.2,:notoff0=>true)
- when 3
- return $save[:stars]+=40 if $game.stopped
- $game.stop_time(Snd['Timestop'].play)
- when 4
- Snd['KO'].play
- Projectile.new(@x,@y-32,2,['Projectiles/Blue Shell',32,32,0],[32,32],40+$save[:strength],:vx=>@model.mirror_x ? -10 : 10,:stop=>true,:element=>0,:animation=>[3,4],:through=>true,:wallbounce=>3,:fx=>0,:fly=>true)
- when 5
- Snd['KO'].play
- Projectile.new(@x,@y-32,2,['Projectiles/Bomb',28,38,0,0],[28,38],200+$save[:strength],:vx=>@model.mirror_x ? -8 : 8,:vy=>-8,:bounce=>-16,:spec1=>true,:harmless=>true,:traction=>0.5,:wallbounce=>-1)
- when 6
- Snd['Hammer'].play
- Projectile.new(@x-16,@y-32,2,'Projectiles/GoldHammer',[32,32],77,:vx=>@model.mirror_x ? -5 : 5,:vy=>-15,:element=>0,:angle=>0,:rotate=>@model.mirror_x ? -15 : 15,:z=>2.2,:absolute=>true,:notoff0=>true)
- when 7
- Snd['KO'].play
- Projectile.new(@x-10,@y-32,3,'Projectiles/Reboundst',[20,18],20+$save[:strength],:dir=>(@model.mirror_x ? 225 : 135),:speed=>8,:bounce=>4,:through=>true,:line=>true)
- when 8
- if @rotodisc
- @rotodisc[0].remove
- @rotodisc=nil
- else
- @rotodisc=[Projectile.new(@x+16,@y-16,0,['Projectiles/Rotodisc',32,32,0],[32,32],30+$save[:strength],:animation=>[21,8],:z=>3,:notoffmap=>true,:repeat=>-1,:through=>true),0]
- end
- when 9
- return $save[:stars]+=60 if @inv and @inv>30
- Trace.new(@x-16,@y-16,2,'Icons/Weapon/9',8)
- # Projectile.new(@x-10,@y-32,3,'Projectiles/Reboundst',[20,18],20+$save[:strength]/8,:dir=>(@model.mirror_x ? 225 : 135),:speed=>8,:bounce=>4,:through=>true,:line=>true)
- @inv=300
- when 10
- Snd['Throw'].play
- Projectile.new(@x-20,@y-24,3,'Projectiles/Knife',[19,7],5+$save[:strength],:dir=>(@model.mirror_x ? 270 : 90),:speed=>24,:bounce=>1,:mirrorx=>@model.mirror_x,:element=>1)
- when 11
- Snd['Barret'].play
- # dir=(@model.mirror_x ? -48 : 48)
- dir=48
- @aim||=0
- x=@x+offset_x(@aim,dir) ; y=@y+offset_y(@aim,dir)
- Trace.new(@x,@y,2,'Effects/Firecone',20,:angle=>angle(@x,@y,x,y))
- Projectile.new(@x,@y,3,'Projectiles/Barret',[18,18],500,:dir=>(angl=angle(0,0,offset_x(@aim,dir),offset_y(@aim,dir))),:angle=>angl,:speed=>60,:element=>1,:bounce=>1,:through=>true,:accurate=>true)
- @aim=nil
- @reload=180
- when 12
- return $save[:stars]+=20 if @boomerang
- @boomerang=Projectile.new(@x-15,@y-16,1,'Projectiles/Boomerang',[32,32],80+$save[:strength],:dir=>(@model.mirror_x ? 315 : 45),:speed=>8,:through=>true,:element=>2,:rotate=>(dir==:left ? -16 : 16),:boomerang=>0,:target=>self,:z=>3,:notoffmap=>true,:reach=>32,:accuracy=>3)
- when 13
- Snd['Guard'].play
- Trace.new(@x-16,@y-16,2,'Icons/Weapon/13',8)
- $save[:status]='PROTEC'
- @status=900
- when 14
- Snd['KO'].play
- Projectile.new(@x-16,@y-72,3,['Objects/POW',32,32,0],[32,32],0,:animation=>[4,8],:dir=>180,:speed=>0,:harmless=>true,:pow=>true)
- when 15
- Snd['Throw'].play
- Projectile.new(@x-16,@y-24,3,'Projectiles/Shuriken',[16,16],25+($save[:strength]*1.5).to_i,:dir=>(@model.mirror_x ? 270 : 90),:rotate=>(@model.mirror_x ? 32 : -32),:speed=>30,:bounce=>1,:mirror_x=>@model.mirror_x,:element=>1,:shuri=>true)
- when 16
- if @starman
- @starman.stop
- @starman=nil
- else
- @starman=Snd["Starman"].play
- end
- end
- end
- end
- def warp(dir,save=nil)
- @firebar=@pound=nil
- @model.animation(@animations[:warp],:force=>true)
- @warp=[dir,32,save]
- @model.mirror_x=true if dir==:left
- @model.mirror_x=nil if dir==:right
- @warp2=dir
- end
- def key(id,looping=true)
- return if @ignore or @pound or warping? or $save[:status]=='STONE'
- Keypress[id,looping]
- end
- def jump
- if $save[:equip][5]==5 and $save[:hp]<$save[:max_hp]
- heal=[$save[:max_hp]/400+1,$save[:max_hp]-$save[:hp]].min
- Info.new(@x-7,@y-40,"+#{heal}","Damage2")
- $save[:hp]+=heal
- end
- end
- def warping?(w2=nil)
- @warp or @warp2 &&w2
- end
- def unpound
- @pound=nil
- end
- def reset
- @pound=@wall=@wing=@glide=nil
- end
- def pound!
- @pound=20
- @vy=16
- end
- def set_att(id)
- level=$save[:magic][id][1]
- case id
- when 0
- $items[:magic][id][:attack]=[5,15,25][level]
- when 1
- $items[:magic][id][:attack]=[15,20,20][level]
- when 2
- $items[:magic][id][:attack]=[40,45,60][level]
- when 4
- $items[:magic][id][:attack]=[70,85,95,120][level]
- when 7
- $items[:magic][id][:attack]=10+level/2*5
- when 8
- $items[:magic][id][:attack]=50+level*25
- when 9
- $items[:magic][id][:attack]=20+level*20
- when 10
- $items[:magic][id][:attack]=15+level*15
- when 11
- $items[:magic][id][:attack]=20+level*5
- when 13
- $items[:magic][id][:attack]=60+level*20
- when 14
- $items[:magic][id][:attack]=20+level*20
- end
- end
- def check(x,y,down);return if !@solid
- !@model.mirror_x && x.between?(@x-24,@x) || @model.mirror_x && x.between?(@x,@x+24) and y.between?(@y-24,@y+24)
- end
- def size;[0,0];end
- def mammamia
- @vx=0
- @mammamia=true
- @model.animation(@animations[:mammamia],:force=>true)
- end
- def demammamia;@mammamia=nil;end
- def portal(x,y)
- @portal=[x,y]
- end
- def deportal
- @vx=@vy=0
- @portal=nil
- end
- end
- class Projectile < Enemy
- attr_reader :size
- attr_writer :type,:vx,:vy
- attr_accessor :args
- def initialize(x,y,type,img,size,attack,args={})
- @x,@y,@type,@img,@size,@attack,@args=x,y,type,img,size,attack,args
- @through=@args[:through]
- @animation=[0]+@args[:animation] if @args[:animation]
- @args[:offx]||=0;@args[:offy]||=0
- @offx=@args[:offx]
- @offy=@args[:offy]
- @knockback=@args[:knockback] if @args[:knockback]
- @vx=(@args[:vx] ? @args[:vx] : 0) if @type==2
- @vy=(@args[:vy] ? @args[:vy] : 0) if @type==2
- @traction=(@args[:traction] ? @args[:traction] : 1)
- @line=[] if @args[:line]
- @maxline=@args[:line]
- @line << [@x,@y,255] if @line
- @inv=-1
- @args[:angle]||=0 if @args[:rotate]# || @args[:autorotate]
- @active=@notoffmap=true
- @setinv=@args[:setinv]
- @absolute100=@args[:absolute100]
- @setinv||=(@args[:enemy] ? 30 : 15)
- @element=@args[:element]
- @element=@args[:magic] if @args[:magic].class==Fixnum
- @count=0
- @matk=true if @args[:magic] or @element && !@args[:nomagic] && ![0,1,2].include?(@element)
- @harmless=true if @args[:harmless]==true
- @args[:sequence]=[@args[:sequence],0] if @args[:sequence]
- @unstoppable2=@unstoppable=true
- init((:enemy if @args[:enemy]))
- end
- def update ; if @args[:enemy] then super else action end ; end
- def action
- return killl if $game.stopped and !@args[:unstoppable]
- @count+=1
- return if @removed
- remove if !@args[:offdown] and @args[:offscreen] and @x>$game.scx+640 || @x+size[0]<$game.scx || @y>$game.scy+480 || @y+size[1]<$game.scy
- remove if !@args[:offdown] and !@args[:notoffmap] and @x>$game.map.data[:width]*640 || @x+size[0]<0 || @y>$game.map.data[:height]*480 || @y+size[1]<0 && !@args[:notoff0]
- remove if @args[:offdown] and @y>$game.scy+480
- @args[:angle]+=@args[:rotate] if @args[:rotate]
- Snd['Boomerang'].play if @args[:boomerang] and (@args[:boomerang]+=1)%15==0
- case @type
- when 0 #trail
- if @args[:spec1] and !@wait
- Snd['TCharge'].play
- @wait=90
- elsif @args[:spec1] and @wait and (@wait-=1)<=0
- $game.flash(0xffffffff,16)
- Snd['Thunder'].play
- Trail.new(@x-41,@y-16,2.1,'Effects/Thunder',[0],66,:fade=>6,:movex=>(@args[:spec1a] ? @args[:spec1a] : 0))
- Projectile.new(@x-25,@y,0,['Projectiles/Thunder',130,288,0,0],[130,288],120+$save[:intelligence],:element=>5,:animation=>[33,2],:sequence=>[0]+[1,2]*16,:through=>true,:id=>3,:per_frame=>(@args[:spec1a] ? "@x+=#{@args[:spec1a]}" : nil)) if !@args[:enemy]
- Projectile.new(@x-25,@y,0,['Projectiles/Thunder',130,288,0,0],[130,288],@attack,:element=>5,:animation=>[33,2],:sequence=>[0]+[1,2]*16,:through=>true,:enemy=>true) if @args[:enemy]
- remove
- elsif @args[:spec1] or @args[:elec]
- @args[:angle]=rand(360)
- end
- @x-=(@x<=>@args[:targetx])*4 if @args[:targetx]
- @y-=(@y<=>@args[:targety])*4 if @args[:targety]
- return if @args[:spec1]
- @x+=@args[:movex] if @args[:movex]
- @y+=@args[:movey] if @args[:movey]
- @y-=1 if @args[:targety] and @y>@args[:targety]
- @harmless=@args[:harmless].include?(@img[3]) if @args[:harmless]
- if @args[:fade] and @args[:repeat]<@args[:fade]
- @args[:color] ||=Color.new(0xffffffff)
- @args[:color].alpha=((@args[:fade]-(@args[:fade]-@args[:repeat]))*(255.0/@args[:fade])).to_i
- @harmless=true
- end
- if @args[:fade2]
- @args[:color] ||=Color.new(0xffffffff)
- @args[:color].alpha=[@args[:color].alpha-@args[:fade2],0].max
- end
- if @args[:next] and @count==@args[:next][0]
- @args[:next][1]-=1
- Projectile.new(@x+@args[:next][2],@y+@args[:next][3],0,@img[0..2]+[0],@size,@attack,:animation=>@args[:animation],:enemy=>true,:magic=>@args[:magic],:through=>@args[:through],:next=>@args[:next])
- end
- if @args[:eject]
- img=(@img.class == Array ? Tls[@img[0], @img[1], @img[2]][@img[3]] : Img[@img])
- @size[0]=@args[:eject][1]
- if !@args[:eject][2]
- @args[:eject][1]=[@args[:eject][1]+=@args[:eject][0],img.width].min
- @args[:eject][2]=true if @args[:eject][1]==img.width
- else
- @args[:eject][1]-=@args[:eject][0]
- remove if @args[:eject][1]<=0
- end
- if @args[:eject][3]
- @x=@args[:eject][3]+img.width-@args[:eject][1]
- end
- end
- when 1 #aimed
- aim=(@args[:accuracy] ? @args[:accuracy] : 2)
- target=(@args[:target] ? [@args[:target],@args[:target].size[0]/2,@args[:target].size[1]/2] : [$game.player,0,0])
- if (d=angle_diff(@args[:dir],angle(@x,@y,target[0].x+target[1],target[0].y+target[2])).to_i)>(aim-1) then @args[:dir]+=aim elsif d<(aim-1) then @args[:dir]-=aim end if !@args[:limit] || @args[:limit]>0 and not @args[:reach] && target[0].removed and !@args[:wait] || @args[:wait]<0
- @x+=offset_x(@args[:dir],@args[:speed])
- @y+=offset_y(@args[:dir],@args[:speed])
- @args[:angle]=@args[:dir]+90 if @args[:angle] and !@args[:rotate]
- @args[:angle]=rand(360) if @args[:elec]
- @args[:limit]-=1 if @args[:limit] and !@args[:wait] || @args[:wait]<=0
- @args[:wait]-=1 if @args[:wait]
- remove if @args[:afterlimit] and @args[:limit]<=0 and @x>$game.scx+640 || @x+size[0]<$game.scx || @y>$game.scy+480 || @y+size[1]<$game.scy
- @args[:speed]+=@args[:acceleration] if @args[:acceleration]
- remove if @args[:reach] and !@args[:boomerang] || @args[:boomerang]>60 and distance(@x,@y,target[0].x+target[1],target[0].y+target[2])<@args[:reach]
- @args[:notoffmap]=false if @args[:reach] && target[0].removed
- @args[:notoffmap]=true if @args[:limit]
- @args[:notoffmap]=false if @args[:limit] and @args[:limit]<=0
- # @args[:rotate]=offset_x(@args[:dir],@args[:speed]*16) if @args[:autorotate]
- when 2 #falling
- @vx.abs.to_i.times{
- @x+=(@vx<=>0)
- if @args[:climb]
- @args[:climb].times{|y| @y-=1 if @vx<0 && $game.solid?(@x-2,@y+size[1]-1) && !$game.solid?(@x-2,@y+size[1]-1-@args[:climb]+y) || @vx>0 && $game.solid?(@x+size[0]+2,@y+size[1]-1) && !$game.solid?(@x+size[0]+2,@y+size[1]-1-@args[:climb]+y)}
- end
- if @args[:wallbounce] and @vx<0 && $game.solid?(@x-1,@y+size[1]-(@args[:climb] ? @args[:climb]+1 : 1)) || @vx>0 && $game.solid?(@x+size[0]+1,@y+size[1]-(@args[:climb] ? @args[:climb]+1 : 1))
- if @args[:wallbounce]!=0
- Snd['Bump'].play
- @args[:wallbounce]-=1
- Trail.new(@x-4,@y-4,3,['Effects/Bounce',40,40,0],[0,1,2,3],1)
- @vx=-@vx
- else
- if @args[:fx]==0
- Snd['KO'].play
- Particle.new(@x+size[0]/2,@y+size[1]/2,3,@img,vx=-@vx,-6-rand(7),:angle=>0,:rotate=>vx*4)
- end
- eval @args[:on_wall] if @args[:on_wall]
- remove
- break
- end
- end}
- @vy.abs.to_i.times{
- if @vy>0 and @args[:back] != 0 and @args[:bouncenemy] && $game.kill(@x,@y,size[0],size[1],@args[:absolute] ? :absolute : @attack,@args[:element],@args[:id]) || @args[:pow] && $game.pow(@x,@y+size[1]/2,size[0],false) || $game.solid?(@x+@size[0]/2,@y+(@args[:antigrav] ? -1 : @size[1]),true)
- eval @args[:on_fall] if @args[:on_fall]
- vy=@vy
- Snd['Bump'].play if @args[:spec1] and @vy>2
- @vy=0 if @args[:stop]
- @vy=(@args[:bounce]*=@traction) if @args[:bounce]
- @vx*=@traction
- if @args[:back]
- @vx=-@vx
- Snd['Stun'].play
- @args[:back]-=1
- @args[:harmless]=true if @args[:back]==0
- Trail.new(@x-4,@y+8,3,['Effects/Bounce',40,40,0],[0,1,2,3],1)
- if @args[:superbeet]
- Projectile.new(@x+7,@y+6,2,['Projectiles/Beetsmall',14,16,0],[14,16],@attack/2,:sequence=>[0,1,2,1],:animation=>[4,4],:vy=>-6,:vx=>@vx>0 ? -2 : 2,:bounce=>-5,:angle=>0,:element=>0,:fx=>1,:id=>@args[:id],:back=>1,:through=>true,:bouncenemy=>true,:z=>3)
- end
- end
- break if @vy!=vy
- end
- @y+=(@vy<=>0)*(@args[:antigrav] ? -1 : 1)
- }
- @vy+=(@args[:gravity] ? @args[:gravity] : 1) if !@args[:fly]
- @args[:angle] += @args[:rotation] if @args[:rotation]
- @args[:angle]=angle(0,0,@vx,@vy) if @args[:follow]
- if @args[:trail]
- Trail.new(@x-8+rand(17),@y-8+rand(17),1,[@args[:trail][1],@args[:trail][2],@args[:trail][3]],(0...(@args[:trail][4])).to_a,@args[:trail][5]) if ($count% @args[:trail][0])==0
- end
- if @args[:spec1]
- @img[4]+=1
- @img[3]=([0,1]*4+[2,3]*4+[4,5]*4+[6,7]*4)[@img[4]/8]
- if @img[4]==256
- remove
- Snd['Explosion'].play
- Projectile.new(@x-82,@y-45,0,['Projectiles/Explosion',192,128,0],[192,128],200,:animation=>[2,4],:repeat=>16,:z=>3,:through=>true)
- end
- end
- when 3 #straight
- # @args[:speed]+=@args[:acceleration] if @args[:acceleration]
- # remove if vx<0 && @x+size[0]<$game.scx || vx>0 && @x>$game.scx+768 || vy>0 && @y>$game.scy+672 || vy<0 && @y+size[1]<$game.scy
- @args[:speed].to_i.times{@x+=(vx=offset_x(@args[:dir],1)) ; @y+=(vy=offset_y(@args[:dir],1))
- if (@args[:bounce] and (vx<0 and $game.solid?(@x-2,@y) || $game.solid?(@x-2,@y+size[1]-1)) || (vx>0 and $game.solid?(@x+size[0]+1,@y) || $game.solid?(@x+size[0]+1,@y+size[1])))
- @args[:dir]=angle(0,0,-vx,vy)
- @args[:bounce]-=1
- @line << [@x,@y,255] if @line
- break
- elsif @args[:bounce] and (vy<0 and $game.solid?(@x,@y-2) || $game.solid?(@x+size[0]-1,@y-2)) || (vy>0 and $game.solid?(@x,@y+size[1]+1) || $game.solid?(@x+size[0]-1,@y+size[1]+1))
- @args[:dir]=angle(0,0,vx,-vy)
- @line << [@x,@y,255] if @line
- @args[:bounce]-=1
- break
- elsif @args[:bounce] and @args[:bounce]<=0
- if @line
- @removed=true
- else
- remove
- if @args[:shuri]
- Snd['Shuriken'].play
- Particle.new(@x,@y,3,Img['Projectiles/Shuriken'],(4+rand(4))*(@args[:dir]<180 ? 1 : -1),-4-rand(4),:rotate=>-@args[:rotate])
- return
- end
- end
- end
- $game.kill(@x,@y,size[0],size[1],@args[:absolute] ? :absolute : @attack,@args[:element],@args[:id]) if !@args[:enemy] and @args[:accurate]}
- remove if @args[:destroy] and distance(@x,@y,@args[:destroy][0],@args[:destroy][1])<@args[:destroy][2]
- @args[:speed]+=@args[:acceleration] if @args[:acceleration]
- vx=offset_x(@args[:dir],@args[:speed])
- vy=offset_y(@args[:dir],@args[:speed])
- if @args[:stopwall] and $game.solid?(@x+vx/2,@y+vy/2)
- Snd[@args[:stopwall]].play
- @harmless=@frozen=@unhittable=true
- end
- if @args[:float]
- remove if @args[:float]>=2
- @y-=(@args[:float]+=0.05)
- if $game.solid?(@x+vx,@y)
- @args[:dir]=angle(0,0,-vx,vy)
- end
- if $game.solid?(@x,@y+vy)
- @args[:dir]=angle(0,0,vx,-vy)
- end
- $game.hit(@x,@y,size[0],size[1],:specjal1)
- end
- # collided=true if @args[:collide] and vx<0 && $game.solid?(@x+vx,@y.to_i+size[1],true) || vx>0 && $game.solid?(@x+size[0]+vx,@y.to_i+size[1]-1,true) || vy<0 && $game.solid?(@x+vy,@y.to_i+size[1],true) || vy>0 && $game.solid?(@x+size[0]+vy,@y.to_i+size[1]-1,true)
- # collided=true if @args[:collide] and vx<0 && $game.solid?(@x+vx,@y.to_i+size[1]/2,true) || vx>0 && $game.solid?(@x+size[0]+vx,@y.to_i+size[1]/2,true) || vy<0 && $game.solid?(@x+size[0]/2,@y+vy,true) || vy>0 && $game.solid?(@x+size[0]/2,@y+size[1]+vy,true)
- collided=true if @args[:collide] and $game.solid?(@x+(vx>0 ? size[0] : vx==0 ? size[1]/2 : 0)+vx,@y+(vy>0 ? size[1] : vy.to_i==0 ? size[1]/2 : 0)+vy,true)
- if collided
- remove
- eval @args[:on_collide] if @args[:on_collide]
- end
- if @args[:lotus]
- @args[:lotus]-=1
- if @args[:lotus]<0
- @args[:dir]=180
- @args[:speed]=(@args[:slotus] ? 16 : 2)
- @ix||=@x
- @x=@ix-8-offset_x(@args[:lotus]*(@args[:slotus] ? 32 : 8),16)
- Trace.new(@x,@y,3,@img,16) if @args[:slotus]
- end
- end
- if @args[:bolt]
- if !@disp and @y<-96
- @disp=45
- @x=$game.player.x-80+rand(161)
- @y=48
- @args[:speed]=0
- elsif @disp and (@disp-=1)==0
- remove
- Snd['Blast'].play
- Projectile.new(@x-3,-32,0,['Projectiles/Toxbolt',38,448,0],[38,448],120,:animation=>[8,8],:through=>true,:enemy=>true,:harmless=>[0,1,8],:magic=>true,:z=>3)
- end
- end
- if @args[:maxx]
- remove if @x>=@args[:maxx]
- end
- if @args[:minx]
- remove if @x<=@args[:minx]
- end
- if @args[:pow]
- @args[:speed]+=0.5
- if $game.solid?(@x+16,@y+32)
- Snd['KaBoom'].play
- Projectile.new(@x-304,@y-304,0,'Projectiles/Shockwave',[640,640],300,:through=>true,:z=>3,:inv=>120,:repeat=>100,:shock=>true)
- remove
- end
- end
- when 4 #scythe
- @args[:angle]||=0
- Snd['Scythe'].play if $count%15==0
- @args[:angle]+=16
- @phase||=0
- if @phase==0
- if @y>32
- @y-=4
- else
- @phase+=1
- end
- elsif @phase==1
- if @x<960
- @x+=8
- else
- @phase+=1
- end
- elsif @phase==2
- if @y<320
- @y+=8
- else
- @phase+=1
- end
- elsif @phase==3
- if @x>64
- @x-=8
- else
- @phase+=1
- end
- elsif @phase==4
- if distance(@x,@y,@args[:death].x,@args[:death].y-43)>4
- @x+=offset_x(angl=angle(@x,@y,@args[:death].x,@args[:death].y-43),4)
- @y+=offset_y(angl=angle(@x,@y,@args[:death].x,@args[:death].y-43),4)
- elsif !@time
- @time=0
- elsif @time<60
- @time+=1
- else
- remove
- end
- end
- end
- if @args[:trace] and @count% @args[:trace][1]==0
- Trace.new(@x+(@args[:angle] ? size[0]/2 : 0),@y+(@args[:angle] ? size[1]/2 : 0),@args[:z] ? @args[:z]-0.1 : 1.9,@img,@args[:trace][2],:angle=>@args[:angle])
- end
- # puts (!@through || !(@through.class==Fixnum and (@through-=1)>=0))
- # puts $game.kill(@x,@y,size[0],size[1],@args[:absolute] ? :absolute : @attack,@args[:element],@args[:id])
- killl
- # $game.pow(@x,@y+size[1]/2,size[0],false) if @args[:pow]
- if @removed and @args[:remove]
- t=@args[:remove]
- Trail.new(@x+t[0],@y+t[1],2,t[(2..4)],:default,t[5])
- end
- if @removed and @args[:remove2]
- t=@args[:remove2]
- Trace.new(@x+t[0],@y+t[1],2,t[2],t[3])
- end
- if @args[:sizesx]
- @size[0]=@args[:sizesx][@args[:sequence][1]]
- end
- if @args[:offsetsx]
- @offx=@args[:offsetsx][@args[:sequence][1]]
- end
- if @args[:sizesy]
- @size[1]=@args[:sizesy][@args[:sequence][1]]
- end
- if @args[:offsetsy]
- @offy=@args[:offsetsy][@args[:sequence][1]]
- end
- if @args[:per_frame]
- eval @args[:per_frame]
- end
- if @removed and @args[:electrosion]
- Snd['Electrosion'].play
- Trace.new(@x+40,@y+40,2.2,'Projectiles/Electrosion',16,:randangle=>true)
- end
- if @args[:randangle]
- @args[:angle]=rand(360)
- end
- end
- def draw
- if @line
- dis=(@removed ? 12 : @line.length)
- @line[1][2]=@line[0][2]-=dis if @line.length>1
- @line[0][2]-=dis if @line.length==1
- if @line[0][2]<=0
- return remove if @line.length==1
- @line.shift
- @line[0][2]=255
- end
- @line.length.times{|line| if line<@line.length-1 then
- $screen.draw_line(@line[line][0]+size[0]/2,@line[line][1]+size[1]/2,line==0 ? 0x00000000 : line==1 ? Color.new(@line[1][2],255,255,255) : 0xffffffff,@line[line+1][0]+size[0]/2,@line[line+1][1]+size[1]/2,line==0 ? Color.new(@line[0][2],255,255,255) : 0xffffffff,2) else
- $screen.draw_line(@line[line][0]+size[0]/2,@line[line][1]+size[1]/2,line==1 ? Color.new(@line[1][2],255,255,255) : @line.length==1 ? Color.new(@line[0][2],255,255,255) : 0xffffffff,@x+size[0]/2,@y+size[1]/2,0xffffffff,2) end}
- end
- return if !@img or @removed
- if @args[:shock]
- Img[@img].draw_rot(@x+size[0]/2,@y+size[1]/2,3,0,0.5,0.5,(@count%10+1)*0.23,(@count%10+1)*0.23)
- remove if @count==99
- return
- end
- if @args[:animation]
- if (@animation[0]+=1) % @animation[2]==0
- if @args[:sequence]
- @args[:sequence][1]+=1
- @img[3]=@args[:sequence][0][@args[:sequence][1]]
- else
- @img[3]+=1
- end
- end
- if @args[:sequence] && @args[:sequence][1]==@animation[1] or !@args[:sequence] && @img[3]==@animation[1]
- if @args[:sequence]
- @args[:sequence][1]=0
- @img[3]=@args[:sequence][0][@args[:sequence][1]]
- else
- @img[3]=0
- end
- return remove if @type==0 and !@args[:still] and !@args[:repeat] || (@args[:repeat]-=1)==0
- end
- elsif @type==0 and !@args[:spec1]
- return remove if @type==0 and !@args[:still] and !@args[:repeat] || (@args[:repeat]-=1)==0
- end
- img=(@img.class == Array ? Tls[@img[0], @img[1], @img[2]][@img[3]] : Img[@img])
- # Trace.new(@x+(@args[:mirrorx] ? size[0] : 0),@y,@args[:z] ? @args[:z] : 2,(@img.class == Array ? [@img[0], [@img[1], @img[2]],@img[3]] : Img[@img]),@args[:trace][0],:scalex=>(@args[:mirrorx] ? -1 : 1)) if @args[:trace] and $game.time % @args[:trace][1]==0
- if @args[:eject]
- $screen.clip_to(@x,@y,@args[:eject][1],@y+12){img.draw(@x+(@args[:mirrorx] ? @args[:eject][1] : 0),@y,@args[:z] ? @args[:z] : 2,@args[:mirrorx] ? -1 : 1,1)}
- else
- if @args[:angle]
- origin=(@args[:origin] ? @args[:origin] : [size[0]/2,size[1]/2,0.5,0.5])
- img.draw_rot(@x+origin[0],@y+origin[1],@args[:z] ? @args[:z] : 2,@args[:angle],origin[2],origin[3],(@args[:mirrorx] ? -1 : 1)*(@args[:scale] ? @args[:scale] : 1),@args[:scale] ? @args[:scale] : 1,@args[:color] ? @args[:color] : 0xffffffff)
- else
- img.draw(@x+(@args[:mirrorx] ? img.width : 0),@y,@args[:z] ? @args[:z] : 2,@args[:mirrorx] ? -1 : 1,1,@args[:color] ? @args[:color] : 0xffffffff)
- end end
- end
- def killl
- _remove if !@args[:harmless] and !@args[:bouncenemy] and !@args[:enemy] && $game.kill(@x,@y,size[0],size[1],@args[:absolute] ? :absolute : @attack,@element ? @element : @matk,@args[:id],@setinv) || @args[:enemy] && @attacked and !@through || @through.class==Fixnum && (@through-=1)==0
- _remove if @args[:enemy]==:both && $game.kill(@x,@y,size[0],size[1],@args[:absolute] ? :absolute : @attack,@args[:element],@args[:id]) and !@through
- end
- def _remove
- @args[:on_hit] ? eval(@args[:on_hit]) : remove
- end
- end
- class Corpse < Entity
- def initialize(x,y,vx,vy,slash=nil)
- @x,@y,@vx,@vy,@slash=x,y,vx,vy,slash
- @vy=13 if slash
- @vx=1 if slash
- init
- end
- def update
- return if @slash
- @vx.to_i.abs.times{@x+=(@vx<=>0) ; @vx=-@vx if $game.solid?(@vx<0 ? @x-1 : @x+48,@y+15)}
- @vy.to_i.abs.times{@y+=(@vy<=>0) ; if $game.solid?(@x+24,@vy<0 ? @y-1 : @y+30) ; if @vy<0 ; @vy=-@vy else @vy=@vx=0 ; @fallen=true end end}
- @vy+=1 if !@fallen
- end
- def draw
- if @slash
- @vy+=1.0/@vx
- @vx+=0.1
- Tls['Objects/Mario2',32,39][0].draw(@x+(@slash==:left ? 32 : 0),@y-@vy,1.5,@slash==:left ? -1 : 1)
- Tls['Objects/Mario2',32,39][1].draw(@x+(@slash==:left ? 32 : 0),@y+@vy,1.5,@slash==:left ? -1 : 1)
- else
- Tls['Objects/Mario',48,29][@fallen ? 1 : 0].draw(@x,@y,1.5)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement