public bool OnCast(Character caster, string args) { args = args.Replace(" at ", ""); Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); int duration = 3; // 3 rounds, base if (caster.species == Globals.eSpecies.Arachnid || Autonomy.EntityBuilding.EntityLists.ARACHNID.Contains(caster.entity)) { duration += caster.Level / 2; } else if (caster.IsSpellWarmingProfession && caster.preppedSpell == GameSpell.GetSpell((int)GameSpell.GameSpellID.Create_Web)) { duration += Skills.GetSkillLevel(caster.magic) / 3; } duration += Rules.Dice.Next(-1, 1); if (target == null) { Cell targetCell = Map.GetCellRelevantToCell(caster.CurrentCell, args, false); if (targetCell != null) { AreaEffect effect = new AreaEffect(Effect.EffectTypes.Web, Cell.GRAPHIC_WEB, Skills.GetSkillLevel(caster.magic), duration, caster, targetCell); targetCell.EmitSound(ReferenceSpell.SoundFile); } } else { AreaEffect effect = new AreaEffect(Effect.EffectTypes.Web, Cell.GRAPHIC_WEB, Skills.GetSkillLevel(caster.magic), duration, caster, target.CurrentCell); if (target.CurrentCell != null) { target.CurrentCell.EmitSound(ReferenceSpell.SoundFile); } } if (target == null) { caster.WriteToDisplay("You cast " + ReferenceSpell.Name + "."); } else { caster.WriteToDisplay("You cast " + ReferenceSpell.Name + " at " + target.GetNameForActionResult(true).Replace("The ", "the ")); } return(true); }
public bool OnCast(Character caster, string args) { ReferenceSpell.SendGenericCastMessage(caster, null, true); int bitcount = 0; //loop through all visible cells for (int ypos = -3; ypos <= 3; ypos += 1) { for (int xpos = -3; xpos <= 3; xpos += 1) { Cell cell = Cell.GetCell(caster.FacetID, caster.LandID, caster.MapID, caster.X + xpos, caster.Y + ypos, caster.Z); if (caster.CurrentCell.visCells[bitcount] && cell.IsSecretDoor) { if (cell.AreaEffects.ContainsKey(Effect.EffectTypes.Hide_Door)) { cell.AreaEffects[Effect.EffectTypes.Hide_Door].StopAreaEffect(); } else { Effect.EffectTypes effectType = Effect.EffectTypes.Find_Secret_Door; string soundFile = Sound.GetCommonSound(Sound.CommonSound.OpenDoor); if (cell.DisplayGraphic == Cell.GRAPHIC_MOUNTAIN || cell.CellGraphic == Cell.GRAPHIC_MOUNTAIN) { effectType = Effect.EffectTypes.Find_Secret_Rockwall; soundFile = Sound.GetCommonSound(Sound.CommonSound.SlidingRockDoor); } AreaEffect effect = new AreaEffect(effectType, Cell.GRAPHIC_EMPTY, 0, (Skills.GetSkillLevel(caster.magic) / 2) + 10, caster, cell); cell.EmitSound(soundFile); } } bitcount++; } } return(true); }