Paste #6422: Untitled Paste

Date: 2014/07/05 21:29:48 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


MagicMissileLaunch:
  type: task
  definitions: player
  script:
  - ^define ManaCost <player[%player%].flag[Intelligence].mul[2].asint>
  - ^if !<player[%player%].flag[CurrentMana].asint> > %ManaCost% {
       - ^narrate "<red>You don't have enough mana to do that."
       - ^queue clear
     }
  - ^flag player player:%player% CurrentMana:<player.flag[CurrentMana].sub[<def[ManaCost].asint>]>
  - ^flag player player:%player% MagicMissileCD:true duration:5s
  - ^define range <player[%player%].flag[Intelligence].add[5].asint>
  - ^define entity e@firework[firework_item=i@firework[firework=true,false,BALL,255,0,0,0,255,0]]
  - ^push %entity% origin:<%player%.eye_location> origin:%player% destination:<%player%.location.cursor_on[<def[range].asint>]> script:MagicMissileImpact
  - ^push firework origin:<%player%.eye_location> origin:%player% destination:<%player%.location.cursor_on[<def[range].asint>]> script:MagicMissileImpact
MagicMissileImpact:
  type: task
  script:
  - ^define location <def[last_entity].location>
  - ^narrate "%location%" t:p@Ares513
  - ^narrate "%last_entity%" t:p@Ares513
  - ^narrate "<player>" t:p@Ares513
  - ^define targets <def[location].find.entities.within[5]>
  - ^define removed <def[targets].as_list.exclude[<player>]>
  - ^if <player.is_op> narrate "Without player %removed%"
  - ^if <player.is_op> narrate "With player %targets%"
  - ^hurt <player.flag[Level].add[<player.flag[Intelligence].div[2]>]> %removed%
  - ^playeffect %location% effect:LARGE_EXPLODE qty:5
  - ^playeffect %location% effect:MAGIC qty:5
  - ^remove %last_entity%