Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.93 KB | None | 0 0
  1.  
  2. Unless required by applicable law or agreed to in writing, software
  3. distributed under the License is distributed on an "AS IS" BASIS,
  4. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  5. See the License for the specific language governing permissions and
  6. limitations under the License.
  7. */
  8. @SuppressWarnings("unchecked")
  9. public class Spell_PrismaticSpray extends Spell
  10. {
  11. public String ID() { return "Spell_PrismaticSpray"; }
  12. public String name(){return "PrismaticSpray";}
  13. public String displayText(){return "(Blinded by the Prismatic Spray)";}
  14. public int maxRange(){return adjustedMaxInvokerRange(5);}
  15. public int minRange(){return 1;}
  16. public int abstractQuality(){return Ability.QUALITY_MALICIOUS;}
  17. public int classificationCode(){ return Ability.ACODE_SPELL|Ability.DOMAIN_EVOCATION;}
  18.  
  19. public void affectEnvStats(Environmental affected, EnvStats affectableStats)
  20. {
  21. super.affectEnvStats(affected,affectableStats);
  22. affectableStats.setSensesMask(affectableStats.sensesMask()|EnvStats.CAN_NOT_SEE);
  23. }
  24.  
  25. public void unInvoke()
  26. {
  27. // undo the affects of this spell
  28. if((affected==null)||(!(affected instanceof MOB)))
  29. return;
  30. MOB mob=(MOB)affected;
  31. super.unInvoke();
  32.  
  33. if(canBeUninvoked())
  34. mob.tell("Your vision returns.");
  35. }
  36.  
  37.  
  38. public boolean invoke(MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel)
  39. {
  40. HashSet h=properTargets(mob,givenTarget,auto);
  41. if(h==null)
  42. {
  43. mob.tell("There doesn't appear to be anybody here to spray.");
  44. return false;
  45. }
  46. // the invoke method for spells receives as
  47. // parameters the invoker, and the REMAINING
  48. // command line parameters, divided into words,
  49. // and added as String objects to a vector.
  50. if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
  51. return false;
  52.  
  53. boolean success=proficiencyCheck(mob,0,auto);
  54.  
  55. int[] types={CMMsg.TYP_FIRE,
  56. CMMsg.TYP_COLD,
  57. CMMsg.TYP_ACID,
  58. CMMsg.TYP_WATER,
  59. CMMsg.TYP_ELECTRIC,
  60. CMMsg.TYP_GAS};
  61. int[] dames={Weapon.TYPE_BURNING,
  62. Weapon.TYPE_FROSTING,
  63. Weapon.TYPE_MELTING,
  64. Weapon.TYPE_BURSTING,
  65. Weapon.TYPE_STRIKING,
  66. Weapon.TYPE_GASSING};
  67. String[] ds={"A blinding red ray",
  68. "A blinding white ray",
  69. "A blinding green ray",
  70. "A blinding blue ray",
  71. "A blinding yellow ray",
  72. "A blinding purple ray"};
  73. if(success)
  74. {
  75.  
  76. int numMissiles=types.length;
  77. if(mob.location().show(mob,null,this,somanticCastCode(mob,null,auto),(auto?"":"^S<S-NAME> point(s) and a spray of colors erupts from <S-HIS-HER> fingertip!^?")+CMProps.msp("web.wav",40)))
  78. {
  79. for(Iterator f=h.iterator();f.hasNext();)
  80. {
  81. MOB target=(MOB)f.next();
  82. if((!auto)&&(target.charStats().getBodyPart(Race.BODY_EYE)!=0))
  83. {
  84. mob.location().show(target,null,CMMsg.MSG_OK_VISUAL,"<S-NAME> go(es) blind!");
  85. success=maliciousAffect(mob,target,asLevel,0,-1);
  86. }
  87. for(int i=0;i<numMissiles;i++)
  88. {
  89. CMMsg msg2=CMClass.getMsg(mob,target,null,CMMsg.MSK_CAST_MALICIOUS_VERBAL|types[i]|(auto?CMMsg.MASK_ALWAYS:0),null);
  90. if(mob.location().okMessage(mob,msg2))
  91. {
  92. mob.location().send(mob,msg2);
  93. int damage = CMLib.dice().roll(2,8+(adjustedLevel(mob,asLevel)+(2*super.getX1Level(mob)))/2,0);
  94. if(msg2.value()>0)
  95. damage = (int)Math.round(CMath.div(damage,2.0));
  96.  
  97. if(target.location()==mob.location())
  98. CMLib.combat().postDamage(mob,target,this,damage,CMMsg.MASK_ALWAYS|types[i],dames[i],"^S"+ds[i]+" <DAMAGE> <T-NAME>!^?");
  99. }
  100. if(target.amDead())
  101. {
  102. target=this.getTarget(mob,commands,givenTarget,true,false);
  103. if(target==null)
  104. break;
  105. if(target.amDead())
  106. break;
  107. }
  108. }
  109. }
  110. }
  111. }
  112. else
  113. return maliciousFizzle(mob,null,"<S-NAME> point(s), but fizzle(s) the spell.");
  114.  
  115. // return whether it worked
  116. return success;
  117. }
  118. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement