Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- @SuppressWarnings("unchecked")
- public class Spell_PrismaticSpray extends Spell
- {
- public String ID() { return "Spell_PrismaticSpray"; }
- public String name(){return "PrismaticSpray";}
- public String displayText(){return "(Blinded by the Prismatic Spray)";}
- public int maxRange(){return adjustedMaxInvokerRange(5);}
- public int minRange(){return 1;}
- public int abstractQuality(){return Ability.QUALITY_MALICIOUS;}
- public int classificationCode(){ return Ability.ACODE_SPELL|Ability.DOMAIN_EVOCATION;}
- public void affectEnvStats(Environmental affected, EnvStats affectableStats)
- {
- super.affectEnvStats(affected,affectableStats);
- affectableStats.setSensesMask(affectableStats.sensesMask()|EnvStats.CAN_NOT_SEE);
- }
- public void unInvoke()
- {
- // undo the affects of this spell
- if((affected==null)||(!(affected instanceof MOB)))
- return;
- MOB mob=(MOB)affected;
- super.unInvoke();
- if(canBeUninvoked())
- mob.tell("Your vision returns.");
- }
- public boolean invoke(MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel)
- {
- HashSet h=properTargets(mob,givenTarget,auto);
- if(h==null)
- {
- mob.tell("There doesn't appear to be anybody here to spray.");
- return false;
- }
- // the invoke method for spells receives as
- // parameters the invoker, and the REMAINING
- // command line parameters, divided into words,
- // and added as String objects to a vector.
- if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
- return false;
- boolean success=proficiencyCheck(mob,0,auto);
- int[] types={CMMsg.TYP_FIRE,
- CMMsg.TYP_COLD,
- CMMsg.TYP_ACID,
- CMMsg.TYP_WATER,
- CMMsg.TYP_ELECTRIC,
- CMMsg.TYP_GAS};
- int[] dames={Weapon.TYPE_BURNING,
- Weapon.TYPE_FROSTING,
- Weapon.TYPE_MELTING,
- Weapon.TYPE_BURSTING,
- Weapon.TYPE_STRIKING,
- Weapon.TYPE_GASSING};
- String[] ds={"A blinding red ray",
- "A blinding white ray",
- "A blinding green ray",
- "A blinding blue ray",
- "A blinding yellow ray",
- "A blinding purple ray"};
- if(success)
- {
- int numMissiles=types.length;
- 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)))
- {
- for(Iterator f=h.iterator();f.hasNext();)
- {
- MOB target=(MOB)f.next();
- if((!auto)&&(target.charStats().getBodyPart(Race.BODY_EYE)!=0))
- {
- mob.location().show(target,null,CMMsg.MSG_OK_VISUAL,"<S-NAME> go(es) blind!");
- success=maliciousAffect(mob,target,asLevel,0,-1);
- }
- for(int i=0;i<numMissiles;i++)
- {
- CMMsg msg2=CMClass.getMsg(mob,target,null,CMMsg.MSK_CAST_MALICIOUS_VERBAL|types[i]|(auto?CMMsg.MASK_ALWAYS:0),null);
- if(mob.location().okMessage(mob,msg2))
- {
- mob.location().send(mob,msg2);
- int damage = CMLib.dice().roll(2,8+(adjustedLevel(mob,asLevel)+(2*super.getX1Level(mob)))/2,0);
- if(msg2.value()>0)
- damage = (int)Math.round(CMath.div(damage,2.0));
- if(target.location()==mob.location())
- CMLib.combat().postDamage(mob,target,this,damage,CMMsg.MASK_ALWAYS|types[i],dames[i],"^S"+ds[i]+" <DAMAGE> <T-NAME>!^?");
- }
- if(target.amDead())
- {
- target=this.getTarget(mob,commands,givenTarget,true,false);
- if(target==null)
- break;
- if(target.amDead())
- break;
- }
- }
- }
- }
- }
- else
- return maliciousFizzle(mob,null,"<S-NAME> point(s), but fizzle(s) the spell.");
- // return whether it worked
- return success;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement