public bool OnCast(Character caster, string args) { ReferenceSpell.SendGenericCastMessage(caster, null, true); // clean up the args args = args.Replace(ReferenceSpell.Command, ""); args = args.Replace("lava", ""); args = args.Trim(); string[] sArgs = args.Split(" ".ToCharArray()); // Path is blocked. Spell failure. if (Map.IsSpellPathBlocked(Map.GetCellRelevantToCell(caster.CurrentCell, args, true))) { return(false); } if (Map.GetCellRelevantToCell(caster.CurrentCell, args, true) != null) { AreaEffect effect = new AreaEffect(Effect.EffectTypes.Lava, Cell.GRAPHIC_FIRE, Skills.GetSkillLevel(caster.magic) * 20, Skills.GetSkillLevel(caster.magic) * 2, caster, Map.GetCellRelevantToCell(caster.CurrentCell, args, false)); Map.GetCellRelevantToCell(caster.CurrentCell, args, true).SendShout("a bubbling hiss."); } caster.WriteToDisplay("A geyser of molton hot lava blasts through the surface and begins to spread rapidly."); return(true); }
public bool OnCast(Character caster, string args) { // clean up the args args = args.Replace("bonfire", ""); args = args.Trim(); string[] sArgs = args.Split(" ".ToCharArray()); if (Map.IsSpellPathBlocked(Map.GetCellRelevantToCell(caster.CurrentCell, args, true))) { return(false); } Cell targetCell = Map.GetCellRelevantToCell(caster.CurrentCell, args, true); if (targetCell != null) { AreaEffect effect = new AreaEffect(Effect.EffectTypes.Fire, Cell.GRAPHIC_FIRE, (int)(Skills.GetSkillLevel(caster.magic) * 2.5), (int)(Skills.GetSkillLevel(caster.magic) * 1.5), caster, Map.GetCellRelevantToCell(caster.CurrentCell, args, false)); targetCell.SendShout("a roaring fire."); targetCell.EmitSound(ReferenceSpell.SoundFile); } caster.WriteToDisplay("You create a magical " + ReferenceSpell.Name.ToLower() + "."); return(true); }
public bool OnCast(Character caster, string args) { ReferenceSpell.SendGenericCastMessage(caster, null, true); if (args == null) { args = ""; } int multiplier = 0; Item totem = caster.FindHeldItem(Item.ID_BLOODWOOD_TOTEM); if (totem != null && !totem.IsAttunedToOther(caster) && totem.AlignmentCheck(caster)) { multiplier += Rules.RollD(1, 3) + 1; caster.WriteToDisplay("Your " + totem.name + " glows brightly for a moment."); } int skillLevel = Skills.GetSkillLevel(caster, Globals.eSkillType.Magic); AreaEffect effect = new AreaEffect(Effect.EffectTypes.Locust_Swarm, Cell.GRAPHIC_LOCUST_SWARM, (skillLevel + multiplier) * (ReferenceSpell.RequiredLevel / 2), Rules.RollD(3, 4) + multiplier, caster, Map.GetCellRelevantToCell(caster.CurrentCell, args, true)); return(true); }
public List <AreaEffect> EffectsFactory(INodeContext context) { var effect = new AreaEffect("fertile", context.Center, NodeSize / 2, context.Rnd.NextDouble() + 1); return(new List <AreaEffect>() { effect }); }
public void SetColour(double r, double g, double b) { var hueColor = new huestream.Color(); hueColor.SetR(r); hueColor.SetG(g); hueColor.SetB(b); AreaEffect.SetColorAnimation(new ConstantAnimation(hueColor.R), new ConstantAnimation(hueColor.G), new ConstantAnimation(hueColor.B)); }
public void SetColour(Color color) { var hueColor = new huestream.Color(); hueColor.SetR(color.R / 255d); hueColor.SetG(color.G / 255d); hueColor.SetB(color.B / 255d); AreaEffect.SetColorAnimation(new ConstantAnimation(hueColor.R), new ConstantAnimation(hueColor.G), new ConstantAnimation(hueColor.B)); }
public void FadeOut() { var hueColor = new huestream.Color(); hueColor.SetR(0); hueColor.SetG(0); hueColor.SetB(0); AreaEffect.SetColorAnimation(new TweenAnimation(0, 500, TweenType.Linear), new TweenAnimation(0, 500, TweenType.Linear), new TweenAnimation(0, 500, TweenType.Linear)); }
public bool OnCast(Character caster, string args) { Cell cell = Map.GetCellRelevantToCell(caster.CurrentCell, args, true); bool spellSuccess = false; switch (cell.CellGraphic) { case Cell.GRAPHIC_CLOSED_DOOR_VERTICAL: case Cell.GRAPHIC_CLOSED_DOOR_HORIZONTAL: case Cell.GRAPHIC_OPEN_DOOR_VERTICAL: case Cell.GRAPHIC_OPEN_DOOR_HORIZONTAL: caster.WriteToDisplay("You use your magic to conceal the door."); spellSuccess = true; break; case Cell.GRAPHIC_EMPTY: if (cell.IsSecretDoor && (cell.AreaEffects.ContainsKey(Effect.EffectTypes.Find_Secret_Door) || cell.AreaEffects.ContainsKey(Effect.EffectTypes.Find_Secret_Rockwall))) { if (cell.AreaEffects.ContainsKey(Effect.EffectTypes.Find_Secret_Door)) { caster.WriteToDisplay("You use your magic to close the secret door."); cell.AreaEffects[Effect.EffectTypes.Find_Secret_Door].StopAreaEffect(); } if (cell.AreaEffects.ContainsKey(Effect.EffectTypes.Find_Secret_Rockwall)) { caster.WriteToDisplay("You use your magic to conceal the secret door."); cell.AreaEffects[Effect.EffectTypes.Find_Secret_Rockwall].StopAreaEffect(); } spellSuccess = true; } break; default: caster.WriteToDisplay(GameSystems.Text.TextManager.YOUR_SPELL_FAILS); caster.EmitSound(Sound.GetCommonSound(Sound.CommonSound.SpellFail)); break; } if (spellSuccess) { cell.IsSecretDoor = true; int skillLevel = Skills.GetSkillLevel(caster.magic); AreaEffect effect = new AreaEffect(Effect.EffectTypes.Hide_Door, Cell.GRAPHIC_WALL, 0, skillLevel * skillLevel, caster, cell); return(true); } return(false); }
public override void processMessage(NetWorker.Utilities.RawMessage message) { int instanceId = message.getInt("iid"); int typeId = message.getInt("tid"); User ownerUser = Engine.Game.getUserById(message.getInt("uid")); float[] position = message.getFloatArray("pos"); if (ownerUser != null) { AreaEffect areaEffect = (AreaEffect)Activator.CreateInstance(TypeIdGenerator.getAreaEffectClass(typeId), instanceId, ownerUser.player, new Vector3(position[0], position[1], position[2])); Engine.Game.AddAreaEffect(areaEffect); Runner.Graphics.createAreaEffect(areaEffect); } }
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 static void sendMessage(ICollection <Player> receiverPlayers, AreaEffect areaEffect) { if (receiverPlayers != null && receiverPlayers.Count != 0) { RawMessage msg = new RawMessage(); msg.putInt("id", TypeIdGenerator.getMessageId(typeof(GAddAreaEffect))); msg.putInt("iid", areaEffect.instanceId); msg.putInt("tid", TypeIdGenerator.getAreaEffectId(areaEffect.GetType())); msg.putInt("uid", areaEffect.ownerPlayer.user.id); Vector3 position = areaEffect.getWorldPosition(); msg.putFloatArray("pos", new float[] { position.x, position.y, position.z }); foreach (var receiverPlayer in receiverPlayers) { receiverPlayer.user.session.client.SendMessage(msg); } } }
public bool OnCast(Character caster, string args) { caster.CurrentCell.EmitSound(Sound.GetCommonSound(Sound.CommonSound.Whirlwind)); ReferenceSpell.SendGenericCastMessage(caster, null, true); if (args == null) { args = ""; } Cell targetCell = Map.GetCellRelevantToCell(caster.CurrentCell, args, true); if (targetCell == null) { return(false); } int skillLevel = Skills.GetSkillLevel(caster, Globals.eSkillType.Magic); AreaEffect effect = new AreaEffect(Effect.EffectTypes.Blizzard, Cell.GRAPHIC_ICE_STORM, skillLevel * (ReferenceSpell.RequiredLevel / 2), Rules.RollD(4, 6), caster, targetCell); return(true); }
public void InitHueEdk(string encryptionKey) { if (Client != null) { return; } Client = new Bridge(new BridgeSettings()); Config config = new Config("dataDyneSync", "PC", new PersistenceEncryptionKey(encryptionKey)); config.SetStreamingMode(StreamingMode.STREAMING_MODE_DTLS); HueStream = new HueStream(config); HueStream.RegisterFeedbackHandler(this); IArea area = new Area(-1, 1, 1, -1, "All"); AreaEffect = new AreaEffect(); AreaEffect.AddArea(area); HueStream.AddEffect(AreaEffect); AreaEffect.Enable(); }
public bool OnCast(Character caster, string args) { ReferenceSpell.SendGenericCastMessage(caster, null, true); if (args == null) { args = ""; } Cell targetCell = Map.GetCellRelevantToCell(caster.CurrentCell, args, true); if (targetCell == null) { return(false); } int skillLevel = Skills.GetSkillLevel(caster, Globals.eSkillType.Magic); AreaEffect effect = new AreaEffect(Effect.EffectTypes.Whirlwind, Cell.GRAPHIC_WHIRLWIND, skillLevel * (ReferenceSpell.RequiredLevel / 2), skillLevel / 2, caster, targetCell); 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); }
public bool OnCast(Character caster, string args) { ReferenceSpell.SendGenericCastMessage(caster, null, true); if (args == null) { args = ""; } Cell targetCell = Map.GetCellRelevantToCell(caster.CurrentCell, args, true); if (targetCell == null) { return(false); } int skillLevel = Skills.GetSkillLevel(caster, Globals.eSkillType.Magic); AreaEffect effect = new AreaEffect(Effect.EffectTypes.Tempest, Cell.GRAPHIC_TEMPEST, skillLevel * ReferenceSpell.RequiredLevel, Rules.RollD(2, 4), caster, targetCell); return(true); }
public bool OnCast(Character caster, string args) { // Ravagers may only have one pet at any time. if (caster.Pets.Count > 0) { caster.WriteToDisplay("You may only control one pet."); return(false); } NPC hellhound = null; foreach (NPC npc in EntityCreationManager.AutoCreatedNPCDictionary.Values) { if (npc.entity == EntityLists.Entity.Hellhound) { hellhound = npc.CloneNPC(); break; } } var builder = new EntityBuilder(); if (hellhound == null) { hellhound = new NPC(); if (!builder.BuildEntity("hellhound|from the pits of hell", EntityLists.Entity.Hellhound, hellhound, caster.Map.ZPlanes[caster.Z], Character.ClassType.Fighter.ToString().ToLower())) { caster.WriteToDisplay("Your attempt to summon a hellhound failed."); return(false); } } if (hellhound == null) { caster.WriteToDisplay("Your attempt to summon a hellhound failed."); return(false); } hellhound.Level = caster.Level; hellhound.entity = EntityLists.Entity.Hellhound; builder.SetOnTheFlyVariables(hellhound); hellhound.Hits = hellhound.HitsFull; hellhound.Stamina = hellhound.StaminaFull; hellhound.Mana = hellhound.ManaFull; hellhound.shortDesc = "hellhound"; hellhound.Alignment = Globals.eAlignment.Evil; hellhound.Age = 0; hellhound.special = "despawn"; int timeRemaining = caster.Level / 4 * 10; // 20 minutes at level 8, 2 minutes per level after level 8 hellhound.RoundsRemaining = Utils.TimeSpanToRounds(new TimeSpan(0, timeRemaining, 0)); hellhound.species = Globals.eSpecies.Magical; // this may need to be changed for AI to work properly hellhound.canCommand = true; hellhound.IsMobile = true; hellhound.IsSummoned = true; hellhound.IsUndead = false; hellhound.FollowID = caster.UniqueID; hellhound.PetOwner = caster; caster.Pets.Add(hellhound); hellhound.LandID = caster.LandID; hellhound.MapID = caster.MapID; hellhound.X = caster.X; hellhound.Y = caster.Y; hellhound.Z = caster.Z; hellhound.AddToWorld(); caster.CurrentCell.EmitSound(GameSpell.GameSpellDictionary[(int)GameSpell.GameSpellID.Firestorm].SoundFile); AreaEffect flames = new AreaEffect(Effect.EffectTypes.Fire, GameWorld.Cell.GRAPHIC_FIRE, 0, 1, caster, caster.CurrentCell); caster.SendToAllInSight("A portal ringed by flames flashes into existence and an enormous, sinewy hellhound slowly walks out and over to " + caster.GetNameForActionResult(true) + "'s side."); caster.WriteToDisplay("A portal ringed by flames flashes into existence and an enormous, sinewy hellhound slowly walks out and over to your side."); hellhound.EmitSound(hellhound.attackSound); Effect.CreateCharacterEffect(Effect.EffectTypes.Flame_Shield, hellhound.Level, hellhound, -1, hellhound); hellhound.SendToAllInSight(hellhound.GetNameForActionResult() + " is surrounded by a shield of flames."); return(true); }
private static AreaEffect ParseAreaEffect(Dictionary <string, object> data) { AreaEffect effect = new AreaEffect(); if (data.ContainsKey("id")) { effect.Id = int.Parse(data["id"].ToString()); } if (data.ContainsKey("posX")) { effect.PosX = int.Parse(data["posX"].ToString()); } if (data.ContainsKey("posY")) { effect.PosY = int.Parse(data["posY"].ToString()); } if (data.ContainsKey("posZ")) { effect.PosZ = int.Parse(data["posZ"].ToString()); } if (data.ContainsKey("startTime")) { effect.StartTime = int.Parse(data["startTime"].ToString()); } //MoveDistance //MoveDuration //MovMaxHeight if (data.ContainsKey("abnormalityRate")) { effect.AbnormalityRate = float.Parse(data["abnormalityRate"].ToString()); } if (data.ContainsKey("atk")) { effect.Atk = float.Parse(data["atk"].ToString()); } if (data.ContainsKey("HpDiff")) { foreach (var abData in (List <Dictionary <string, object> >)data["HpDiff"]) //0..1 { effect.HpDiff = int.Parse(abData["value"].ToString()); } } if (data.ContainsKey("MpDiff")) { foreach (var abData in (List <Dictionary <string, object> >)data["MpDiff"]) //0..1 { effect.MpDiff = int.Parse(abData["value"].ToString()); } } //Teleport effect.AbnormalityOnCommon = new List <int>(); if (data.ContainsKey("AbnormalityOnCommon")) { foreach (var abData in (List <Dictionary <string, object> >)data["AbnormalityOnCommon"]) //0..* { effect.AbnormalityOnCommon.Add(int.Parse(abData["id"].ToString())); } } if (data.ContainsKey("AbnormalityOnPvp")) { foreach (var abData in (List <Dictionary <string, object> >)data["AbnormalityOnPvp"]) //0..1 { effect.AbnormalityOnPvP = int.Parse(abData["id"].ToString()); } } return(effect); }
public bool OnCast(Character caster, string args) { args = args.Replace(ReferenceSpell.Command, ""); args = args.Trim(); Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); Cell dCell = null; if (target == null) { dCell = Map.GetCellRelevantToCell(caster.CurrentCell, args, false); } else { dCell = target.CurrentCell; } if (dCell == null && target == null) { return(false); } //var tCell = Map.GetCellRelevantToCell(caster.CurrentCell, args, true); if (dCell != null) { // destroy all but attuned items foreach (var item in new List <Item>(dCell.Items)) { if (item.attunedID <= 0 && !item.IsArtifact() && !((item is Corpse) && (item as Corpse).IsPlayerCorpse)) { dCell.Remove(item); } } // do spell damage foreach (Character chr in dCell.Characters.Values) { if (Combat.DoSpellDamage(caster, chr, null, Skills.GetSkillLevel(caster.magic) * 10, ReferenceSpell.Name.ToLower()) == 1) { Rules.GiveAEKillExp(caster, chr); } } // destroy walls for a while if (!dCell.IsMagicDead) { if (dCell.DisplayGraphic == Cell.GRAPHIC_WALL) { var newDispGraphic = Rules.RollD(1, 20) >= 10 ? Cell.GRAPHIC_RUINS_LEFT : Cell.GRAPHIC_RUINS_RIGHT; var effect = new AreaEffect(Effect.EffectTypes.Illusion, newDispGraphic, 0, (int)Skills.GetSkillLevel(caster.magic) * 6, caster, dCell); dCell.SendShout("a wall crumbling."); } else if (dCell.DisplayGraphic == Cell.GRAPHIC_RUINS_LEFT || dCell.DisplayGraphic == Cell.GRAPHIC_RUINS_RIGHT) { var newDispGraphic = Rules.RollD(1, 20) >= 10 ? Cell.GRAPHIC_BARREN_LEFT : Cell.GRAPHIC_BARREN_RIGHT; var effect = new AreaEffect(Effect.EffectTypes.Illusion, newDispGraphic, 0, (int)Skills.GetSkillLevel(caster.magic) * 6, caster, dCell); dCell.SendShout("stone crumbling to dust."); } } } ReferenceSpell.SendGenericCastMessage(caster, null, true); return(true); }
public void createAreaEffect(Engine.AreaEffects.AreaEffect areaEffect) { fogObject = (GameObject)GameObject.Instantiate(staticAreaEffectObject, areaEffect.getWorldPosition(), Quaternion.identity); this.areaEffect = areaEffect; }
public bool OnCast(Character caster, string args) { int xpos = 0; int ypos = 0; //clean out the command name args = args.Replace(ReferenceSpell.Command, ""); args = args.Trim(); string[] sArgs = args.Split(" ".ToCharArray()); switch (sArgs[0]) { case "south": case "s": ypos++; break; case "southeast": case "se": ypos++; xpos++; break; case "southwest": case "sw": ypos++; xpos--; break; case "west": case "w": xpos--; break; case "east": case "e": xpos++; break; case "northeast": case "ne": ypos--; xpos++; break; case "northwest": case "nw": ypos--; xpos--; break; case "north": case "n": ypos--; break; default: break; } Cell cell = Cell.GetCell(caster.FacetID, caster.LandID, caster.MapID, caster.X + xpos, caster.Y + ypos, caster.Z); ArrayList cells = new ArrayList(); cells.Add(cell); if ((cell.DisplayGraphic == Cell.GRAPHIC_WALL && !cell.IsMagicDead) || caster.IsImmortal) { ReferenceSpell.SendGenericCastMessage(caster, null, true); AreaEffect effect = new AreaEffect(Effect.EffectTypes.Illusion, Cell.GRAPHIC_EMPTY, 1, 2, caster, cells); } else { //GenericFailMessage(caster, ""); return(false); } return(true); }
/// <summary> /// Finds a target in view. Checks current cell first, then starts in top left, across to right, down (back to left) to right etc. /// </summary> /// <param name="ch">The character attempting to find a target.</param> /// <param name="lookTarget">The target name.</param> /// <param name="countTo">The number of targets with the same name to skip through.</param> /// <returns>The found Character object or null.</returns> public static Character FindTargetInView(Character ch, string lookTarget, int countTo) { try { if (ch == null) { return(null); } if (ch.CurrentCell != null && ((ch.CurrentCell.AreaEffects.ContainsKey(Effect.EffectTypes.Darkness) || ch.CurrentCell.IsAlwaysDark) && !ch.HasNightVision) || ch.IsBlind) { if (!ch.HasTalent(Talents.GameTalent.TALENTS.BlindFighting)) { return(null); } else { // commands allowed if Character has BlindFighting if (!ch.CommandsProcessed.Contains(CommandTasker.CommandType.Attack) && !ch.CommandsProcessed.Contains(CommandTasker.CommandType.Shield_Bash) && !ch.CommandsProcessed.Contains(CommandTasker.CommandType.Kick)) { return(null); } } } int subLen = lookTarget.Length; int itemcount = 1; if (countTo <= 0) { countTo = 1; } if (subLen <= 0) { return(null); // someone entered a command of "fight (or attack) 'something'" where 'something' is a space or other character not decipherable. } foreach (Character target in ch.CurrentCell.Characters.Values) { if (target != ch && Rules.DetectHidden(target, ch) && Rules.DetectInvisible(target, ch) && target.Name.ToLower().StartsWith(lookTarget.ToLower())) { if (countTo == itemcount) { return(target); } itemcount++; } } var cellArray = Cell.GetApplicableCellArray(ch.CurrentCell, ch.GetVisibilityDistance()); var fullCellArray = Cell.GetApplicableCellArray(ch.CurrentCell, Cell.DEFAULT_VISIBLE_DISTANCE); for (int j = 0; j < cellArray.Length; j++) { if (cellArray[j] == null && ch.CurrentCell.visCells[j] && fullCellArray.Length >= j + 1 && fullCellArray[j] != null) { Globals.eLightSource lightsource; // no use for this yet if (fullCellArray[j].HasLightSource(out lightsource) && !AreaEffect.CellContainsLightAbsorbingEffect(fullCellArray[j])) { cellArray[j] = fullCellArray[j]; } } if (cellArray[j] == null || ch.CurrentCell.visCells[j] == false) { // do nothing } else { // create array of targets if (cellArray[j] != ch.CurrentCell && cellArray[j].Characters.Count > 0) { foreach (Character target in cellArray[j].Characters.Values) { if (target != ch && Rules.DetectHidden(target, ch) && Rules.DetectInvisible(target, ch) && target.Name.ToLower().StartsWith(lookTarget.ToLower())) { if (countTo == itemcount) { return(target); } itemcount++; } } } } } return(null); } catch (Exception e) { Utils.LogException(e); return(null); } }
public void TakeDamage(HealthAffect affect, int[] Attackercoords){ playerStats.ChangeHealth (affect); if (workingAI != null) { workingAI.AttackWithoutLooking (Attackercoords); } if (playerStats.health <= 0) { gameObject.SetActive (false); string canEffect = "PlayerEnemy"; canEffect.Replace (canAttack, ""); AreaEffect effect = new AreaEffect (coords, 20, canEffect); print ("Dead"); } }
public void addAreaEffect(AreaEffect areaEffect) { areaEffects.Add(areaEffect.instanceId, areaEffect); // removeAreaEffect fonksiyonu gereksiz cunku areaEffect.destroyable==true oldugu zaman oyun bu areaEffect'i zaten silecek. }
public static void AddAreaEffect(AreaEffect areaEffect) { areaEffects.AddLast(areaEffect); }
public bool OnCast(Character caster, string args) { // Determine map with args. if (args == null || args == "") { caster.WriteToDisplay("You must determine where you will teleport to."); return(false); } // Basically planes of existence are offlimits, for now, or perhaps there will be a planar projection spell in the future. string[] offlimitMaps = new string[] { "eridu", "praetoseba", "hell" }; if (Array.IndexOf(offlimitMaps, args.ToLower()) > -1 && !caster.IsImmortal) { caster.WriteToDisplay("You cannot travel to some planes of existence with the " + ReferenceSpell.Name + " spell."); return(false); } GameWorld.Map destinationMap = null; foreach (GameWorld.Land land in GameWorld.World.GetFacetByID(caster.FacetID).Lands) { foreach (GameWorld.Map map in land.Maps) { if (map.Name.ToLower() == args.ToLower()) { destinationMap = map; break; } } if (destinationMap != null) { break; } } if (destinationMap == null) { caster.WriteToDisplay("There is no such place in this reality."); return(false); } // Get a random cell. Must not be lair, out of bounds, or path blocked. List <Tuple <int, int, int> > cellsList = new List <Tuple <int, int, int> >(destinationMap.cells.Keys); GameWorld.Cell destinationCell = null; do { destinationCell = destinationMap.cells[cellsList[Rules.Dice.Next(cellsList.Count)]]; }while (!CellMeetsTeleportRequirements(destinationCell)); ReferenceSpell.SendGenericCastMessage(caster, null, true); caster.SendToAllInSight("A portal of chaotic energy opens up before you and " + caster.GetNameForActionResult(true) + " steps inside."); caster.WriteToDisplay("A portal of chaotic energy opens up before you and you step inside."); // Whirlwind sound... //caster.CurrentCell.EmitSound(Sound.GetCommonSound(Sound.CommonSound.Whirlwind)); // fail to teleport if holding a corpse or drop it // check caster first, nobody teleports if (!CharacterMeetsTeleportRequirements(caster)) { caster.SendToAllInSight("The chaos portal immediately collapses and " + caster.GetNameForActionResult(true) + " is slammed into the ground."); AreaEffect knockdown = new AreaEffect(Effect.EffectTypes.Concussion, "", 50 + Rules.Dice.Next(-5, +5), 0, caster, caster.CurrentCell); NPC.AIRandomlyMoveCharacter(caster); return(false); } List <Character> teleportedCharacters = null; if (caster.Group != null && caster.Group.GroupMemberIDList != null) { teleportedCharacters = new List <Character>(); foreach (int uniqueID in caster.Group.GroupMemberIDList) { if (uniqueID != caster.UniqueID) { PC pc = PC.GetOnline(uniqueID); if (CharacterMeetsTeleportRequirements(pc)) { teleportedCharacters.Add(pc); pc.WriteToDisplay("You follow " + caster.GetNameForActionResult(true) + " through the chaos portal. You are now in " + pc.Map.Name + "."); } else { pc.WriteToDisplay("You are thrown back out of the chaos portal!"); NPC.AIRandomlyMoveCharacter(pc); } } } } // make the move, clear recall rings. possible stun or blindness and/or damage? GameWorld.Cell chaosPortalCell = caster.CurrentCell; // stored for emote and sound upon portal collapse destinationCell.EmitSound(ReferenceSpell.SoundFile); //destinationCell.EmitSound(Sound.GetCommonSound(Sound.CommonSound.Whirlwind)); SendPortalEntranceEmote(caster); //caster.SendSoundToAllInRange(Sound.GetCommonSound(Sound.CommonSound.MapPortal)); caster.CurrentCell = destinationCell; SendPortalExitEmote(caster); ResetRecallRings(caster); TeleportPets(caster, destinationCell); if (caster.Group != null && teleportedCharacters != null) { foreach (Character chr in teleportedCharacters) { SendPortalEntranceEmote(chr); //chr.SendSoundToAllInRange(Sound.GetCommonSound(Sound.CommonSound.MapPortal)); chr.CurrentCell = destinationCell; SendPortalExitEmote(chr); ResetRecallRings(chr); TeleportPets(chr, destinationCell); } } chaosPortalCell.SendToAllInSight("With a thunder clap, the chaos portal winks out of existence."); chaosPortalCell.EmitSound(Sound.GetCommonSound(Sound.CommonSound.ThunderClap)); return(true); }
public bool OnCast(Character caster, string args) { //clean out the command name args = args.Replace(ReferenceSpell.Command, ""); args = args.Trim(); string[] sArgs = args.Split(" ".ToCharArray()); Cell cell = Map.GetCellRelevantToCell(caster.CurrentCell, args, false); if (cell == null) { caster.WriteToDisplay("Illusion spell format: CAST <illusion type> <direction>"); return(false); } if (cell.IsMagicDead) { //caster.WriteToDisplay("Your spell fails."); //caster.EmitSound(Sound.GetCommonSound(Sound.CommonSound.SpellFail)); return(false); } AreaEffect effect; switch (sArgs[0].ToLower()) { case "wall": ReferenceSpell.SendGenericCastMessage(caster, null, true); effect = new AreaEffect(Effect.EffectTypes.Illusion, Cell.GRAPHIC_WALL, 0, Skills.GetSkillLevel(caster.magic) * 10, caster, cell); break; case "fire": ReferenceSpell.SendGenericCastMessage(caster, null, true); effect = new AreaEffect(Effect.EffectTypes.Illusion, Cell.GRAPHIC_FIRE, 0, Skills.GetSkillLevel(caster.magic) * 10, caster, cell); break; case "bridge": ReferenceSpell.SendGenericCastMessage(caster, null, true); effect = new AreaEffect(Effect.EffectTypes.Illusion, Cell.GRAPHIC_BRIDGE, 0, Skills.GetSkillLevel(caster.magic) * 10, caster, cell); break; case "empty": ReferenceSpell.SendGenericCastMessage(caster, null, true); effect = new AreaEffect(Effect.EffectTypes.Illusion, Cell.GRAPHIC_EMPTY, 0, Skills.GetSkillLevel(caster.magic) * 10, caster, cell); break; case "water": ReferenceSpell.SendGenericCastMessage(caster, null, true); effect = new AreaEffect(Effect.EffectTypes.Illusion, Cell.GRAPHIC_WATER, 0, Skills.GetSkillLevel(caster.magic) * 10, caster, cell); break; case "ice": ReferenceSpell.SendGenericCastMessage(caster, null, true); effect = new AreaEffect(Effect.EffectTypes.Illusion, Cell.GRAPHIC_ICE, 0, Skills.GetSkillLevel(caster.magic) * 10, caster, cell); break; case "forest": ReferenceSpell.SendGenericCastMessage(caster, null, true); effect = new AreaEffect(Effect.EffectTypes.Illusion, Cell.GRAPHIC_FOREST_FULL, 0, Skills.GetSkillLevel(caster.magic) * 10, caster, cell); break; case "tree": ReferenceSpell.SendGenericCastMessage(caster, null, true); effect = new AreaEffect(Effect.EffectTypes.Illusion, Cell.GRAPHIC_FOREST_RIGHT, 0, Skills.GetSkillLevel(caster.magic) * 10, caster, cell); break; case "mountain": ReferenceSpell.SendGenericCastMessage(caster, null, true); effect = new AreaEffect(Effect.EffectTypes.Illusion, Cell.GRAPHIC_MOUNTAIN, 0, 200, caster, cell); break; default: caster.WriteToDisplay(sArgs[0] + " is not a valid illusion type."); caster.WriteToDisplay("Valid Illusions: wall | fire | bridge | empty | water | ice | forest | tree"); break; } return(true); }
public bool OnCommand(Character chr, string args) { int num = 0; #region Handle bad arguments or heavy command weight // TODO: add support for "throw # item at <target>" and "throw # item at # target" if (args == null || args == "" || !args.Contains(" ")) { chr.WriteToDisplay( "Usage of throw: throw <item> <target/direction> | throw <left/right> <target/direction> | throw <item> at # <target>"); return(true); } if (chr.CommandWeight > 3) { chr.WriteToDisplay("Command weight limit exceeded. Throw command not processed."); return(true); } #endregion var sArgs = args.Split(" ".ToCharArray()); var rightHand = false; Item item = null; //var thrownAtTarget = false; if (args.Contains(" at ")) { args = args.Replace(" at ", " "); sArgs = args.Split(" ".ToCharArray()); //thrownAtTarget = true; } else { goto ThrowDirection; } // left hand match if (chr.LeftHand != null && (sArgs[0].ToLower() == "left" || chr.LeftHand.name.ToLower().StartsWith(sArgs[0].ToLower()))) { item = chr.LeftHand; } // right hand match else if (chr.RightHand != null && (sArgs[0].ToLower() == "right" || chr.RightHand.name.ToLower().StartsWith(sArgs[0].ToLower()))) { item = chr.RightHand; rightHand = true; } #region Find throwable item on belt // one hand is empty, check belt for items and use FIRST weapon that may be thrown from belt if (item == null && chr.GetFirstFreeHand() != (int)Globals.eWearOrientation.None) { foreach (string throwFromBelt in Item.ThrowFromBelt) { if (throwFromBelt.ToLower().StartsWith(sArgs[0].ToLower())) { item = chr.RemoveFromBelt(throwFromBelt); if (item != null) { switch (chr.GetFirstFreeHand()) { case (int)Globals.eWearOrientation.Right: chr.EquipRightHand(item); rightHand = true; break; case (int)Globals.eWearOrientation.Left: chr.EquipLeftHand(item); rightHand = false; break; default: break; } break; } } } } #endregion if (item == null) { chr.WriteToDisplay("You do not have a " + sArgs[0] + " to throw."); return(true); } #region Thrown item is attuned if (chr.IsPC && item.IsAttunedToOther(chr)) { chr.CurrentCell.Add(item); chr.WriteToDisplay("The " + item.name + " leaps from your hand!"); if (rightHand) { chr.UnequipRightHand(item); } else { chr.UnequipLeftHand(item); } return(true); } #endregion #region Thrown item is aligned if (!item.AlignmentCheck(chr)) { chr.CurrentCell.Add(item); chr.WriteToDisplay("The " + item.name + " singes your hand and falls to the ground!"); if (rightHand) { chr.RightHand = null; Combat.DoDamage(chr, chr, Rules.Dice.Next(1, 4), false); } else { chr.LeftHand = null; Combat.DoDamage(chr, chr, Rules.Dice.Next(1, 4), false); } return(true); } #endregion Character target = null; #region Throw an item at a target // throw <item> <target>, throw <item> # <target>, throw <item> <direction> // throw <item> at # <target> if (sArgs.Length == 3 && char.IsNumber(sArgs[1].ToCharArray()[0])) { num = Convert.ToInt32(sArgs[1]); target = GameSystems.Targeting.TargetAquisition.FindTargetInView(chr, sArgs[2].ToLower(), num); } else { target = GameSystems.Targeting.TargetAquisition.FindTargetInView(chr, sArgs[1].ToLower(), false, chr.IsImmortal); } Cell targetCell = null; var isFigurine = false; if (target != null) { chr.CommandType = CommandTasker.CommandType.Throw; #region Thrown item is a weapon if (item.itemType == Globals.eItemType.Weapon) { targetCell = target.CurrentCell; chr.EmitSound(Sound.GetCommonSound(Sound.CommonSound.ThrownWeapon)); Combat.DoCombat(chr, target, item); // Possible double attack if returning weapon. if (item != null && item.returning && target != null && !target.IsDead) { Combat.CheckDoubleAttack(chr, target, item); } if (chr.LeftHand != null && chr.LeftHand.returning && chr.LeftHand.itemType == Globals.eItemType.Weapon && target != null && !target.IsDead) { Combat.CheckDualWield(chr, target, chr.LeftHand); } /* The code below was added by mlt in order to give Carfel extra attacks. * A better way to do this is to add a numAttacks or similar attribute to the Character class. */ #region Carfel hard code //if (!chr.IsPC && chr.Name == "Carfel" && target != null && !target.IsDead) //{ // Combat.DoCombat(chr, target, item); // if (target != null && !target.IsDead) // { // Combat.DoCombat(chr, target, item); // } //} #endregion #region Weapon with "figurine" in special - eg: Ebonwood Staff (snake staff) if (item.special.Contains("figurine")) { if (item == chr.RightHand) { chr.UnequipRightHand(item); } else if (item == chr.LeftHand) { chr.UnequipLeftHand(item); } Rules.SpawnFigurine(item, targetCell, chr); } #endregion } #endregion #region else if Figurine thrown at a target else if (item.special.ToLower().Contains("figurine") || item.baseType == Globals.eItemBaseType.Figurine || item.itemID == Item.ID_EBONSNAKESTAFF) // if thrown item is figurine { isFigurine = true; // breakable chance if figurine is fragile if (item.fragile) { // 2d100 roll for fig break var figBreakRoll = Rules.RollD(2, 100); if (chr.IsLucky && Rules.RollD(1, 100) >= 10) { figBreakRoll++; } // two 1's are rolled, character is not lucky if (figBreakRoll == 2) { target.SendShout("something shatter into a hundred pieces."); target.EmitSound(Sound.GetCommonSound(Sound.CommonSound.BreakingGlass)); //TODO implement NPCs throwing figurines Utils.Log(chr.GetLogString() + " broke a figurine. Item ID: " + item.GetLogString() + " FigExp: " + item.figExp.ToString(), Utils.LogType.ItemFigurineUse); } else { Rules.SpawnFigurine(item, target.CurrentCell, chr); } } else { Rules.SpawnFigurine(item, target.CurrentCell, chr); } } #endregion #region else if Bottle thrown at a target else if (item.baseType == Globals.eItemBaseType.Bottle || item is SoulGem) // what to do if the thrown item is a bottle { if (Combat.CheckFumble(chr, item)) { target = chr; chr.SendToAllInSight(chr.Name + " fumbles!"); chr.WriteToDisplay("You fumble!"); } if (item.effectType.Length > 0) { var effectTypes = item.effectType.Split(" ".ToCharArray()); var effectAmounts = item.effectAmount.Split(" ".ToCharArray()); var effectDurations = item.effectDuration.Split(" ".ToCharArray()); for (int a = 0; a < effectTypes.Length; a++) { var effectType = (Effect.EffectTypes)Convert.ToInt32(effectTypes[a]); if (effectType == Effect.EffectTypes.Nitro) { GameSpell.CastGenericAreaSpell(target.CurrentCell, "", Effect.EffectTypes.Nitro, Convert.ToInt32(effectAmounts[a]), ""); } else if (effectType == Effect.EffectTypes.Naphtha) { var cells = new ArrayList { target.CurrentCell }; var effect = new AreaEffect(Effect.EffectTypes.Fire, Cell.GRAPHIC_FIRE, Convert.ToInt32(effectAmounts[a]), Convert.ToInt32(effectDurations[a]), chr, cells); } } } if (item.baseType == Globals.eItemBaseType.Bottle) { target.SendShout("the sound of glass shattering."); } else { target.SendShout("the sound of something shattering."); } target.EmitSound(Sound.GetCommonSound(Sound.CommonSound.BreakingGlass)); if (item == chr.LeftHand) { chr.UnequipLeftHand(item); } if (item == chr.RightHand) { chr.UnequipRightHand(item); } } #endregion else { #region all other thrown objects targetCell = target.CurrentCell; if (Rules.RollD(1, 2) == 1) { chr.WriteToDisplay("Your " + item.name + " bounces harmlessly off of " + target.GetNameForActionResult(true) + "."); } else { chr.WriteToDisplay("You miss!"); } target.WriteToDisplay(chr.GetNameForActionResult() + " misses you!"); if (targetCell != null && !targetCell.Items.Contains(item)) { if (!item.special.Contains("figurine")) { targetCell.Add(item); if (chr.RightHand == item) { chr.UnequipRightHand(item); } else if (chr.LeftHand == item) { chr.UnequipLeftHand(item); } } } #endregion } } else { if (num > 0) { chr.WriteToDisplay(GameSystems.Text.TextManager.NullTargetMessage(sArgs[1] + " " + sArgs[2])); } else { chr.WriteToDisplay(GameSystems.Text.TextManager.NullTargetMessage(sArgs[1])); } return(true); } // ** item may have been removed from hand if fumbled result in Rules.doCombat // if the attack caused fatal damage the item is removed in Combat.DND_Attack if (rightHand && chr.RightHand != null && !item.returning && targetCell != null && !targetCell.Items.Contains(item)) { if (!item.fragile && !isFigurine) { targetCell.Add(item); } chr.UnequipRightHand(item); } else if (!rightHand && chr.LeftHand != null && !item.returning && targetCell != null && !targetCell.Items.Contains(item)) { if (!item.fragile && !isFigurine) { targetCell.Add(item); } chr.UnequipLeftHand(item); } return(true); #endregion ThrowDirection: // left hand match if (chr.LeftHand != null && (sArgs[0].ToLower() == "left" || chr.LeftHand.name.ToLower().StartsWith(sArgs[0].ToLower()))) { item = chr.LeftHand; } // right hand match else if (chr.RightHand != null && (sArgs[0].ToLower() == "right" || chr.RightHand.name.ToLower().StartsWith(sArgs[0].ToLower()))) { item = chr.RightHand; rightHand = true; } if (item == null) { chr.WriteToDisplay("You do not have a " + sArgs[0] + " to throw."); return(true); } #region Throw an item in a direction // not throwing an item AT a target args = ""; for (int a = 1; a < sArgs.Length; a++) { args += sArgs[a] + " "; } Cell cell = Map.GetCellRelevantToCell(chr.CurrentCell, args.Substring(0, args.Length - 1), true); if (cell != chr.CurrentCell) { var pathTest = new PathTest(PathTest.RESERVED_NAME_THROWNOBJECT, chr.CurrentCell); if (!pathTest.SuccessfulPathTest(cell)) { cell = chr.CurrentCell; } pathTest.RemoveFromWorld(); } int totalHeight = 0; // used to record how fall an object falls if (cell != null && cell.DisplayGraphic == Cell.GRAPHIC_AIR) { Segue segue = null; int countLoop = 0; do { segue = Segue.GetDownSegue(Cell.GetCell(cell.FacetID, cell.LandID, cell.MapID, cell.X, cell.Y, cell.Z)); countLoop++; if (segue != null) { cell = Cell.GetCell(cell.FacetID, segue.LandID, segue.MapID, segue.X, segue.Y, segue.Z); totalHeight += segue.Height; } else { break; } } while (cell.CellGraphic == Cell.GRAPHIC_AIR && countLoop < 100); } if (item.effectType.Length > 0) { #region Thrown item causes an effect string[] effectTypes = item.effectType.Split(" ".ToCharArray()); string[] effectAmounts = item.effectAmount.Split(" ".ToCharArray()); string[] effectDurations = item.effectDuration.Split(" ".ToCharArray()); for (int a = 0; a < effectTypes.Length; a++) { Effect.EffectTypes effectType = (Effect.EffectTypes)Convert.ToInt32(effectTypes[a]); if (effectType == Effect.EffectTypes.Nitro) { GameSpell.CastGenericAreaSpell(cell, "", Effect.EffectTypes.Nitro, Convert.ToInt32(effectAmounts[a]), "concussion", chr); } else if (effectType == Effect.EffectTypes.Naphtha) { ArrayList cells = new ArrayList { cell }; AreaEffect effect = new AreaEffect(Effect.EffectTypes.Fire, Cell.GRAPHIC_FIRE, Convert.ToInt32(effectAmounts[a]), Convert.ToInt32(effectDurations[a]), chr, cells); } } if (item.baseType == Globals.eItemBaseType.Bottle) { if (cell.DisplayGraphic != Cell.GRAPHIC_WATER) { cell.SendShout("the sound of glass shattering."); cell.EmitSound(Sound.GetCommonSound(Sound.CommonSound.BreakingGlass)); } else { cell.EmitSound(Sound.GetCommonSound(Sound.CommonSound.Splash)); } } else if (item.fragile) { int breakRoll = Rules.RollD(1, 100); // add experience level of figurine to roll if (item.baseType == Globals.eItemBaseType.Figurine) { breakRoll += Rules.GetExpLevel(item.figExp); // less chance for a lucky character to break a figurine if (chr.IsLucky && Rules.RollD(1, 100) >= 10) { breakRoll += 20; } } if (breakRoll > 25) { cell.Add(item); } else { cell.SendShout("something shatter into pieces."); cell.EmitSound(Sound.GetCommonSound(Sound.CommonSound.BreakingGlass)); if (item.baseType == Globals.eItemBaseType.Figurine) { Utils.Log(chr.GetLogString() + " broke a figurine. Item ID: " + item.GetLogString() + " FigExp: " + item.figExp.ToString(), Utils.LogType.ItemFigurineUse); } } } else { cell.Add(item); } #endregion } else { #region if figurine or snake staff thrown direction if (item.baseType == Globals.eItemBaseType.Figurine || item.special.ToLower().IndexOf("snake") > -1) // if thrown item is figurine { // breakable chance if figurine is fragile if (item.fragile) { // 2d100 roll for fig break int figBreakRoll = Rules.RollD(2, 100); // still a small chance for the figurine to break if (chr.IsLucky && Rules.RollD(1, 100) >= 10) { figBreakRoll++; } // every 20 feet of height dropped increases the chance of a break if (totalHeight > 0) { figBreakRoll -= Convert.ToInt32(totalHeight / 20); } if (figBreakRoll <= 2) { cell.SendShout("something shatter into a hundred pieces."); cell.EmitSound(Sound.GetCommonSound(Sound.CommonSound.BreakingGlass)); Utils.Log(chr.GetLogString() + " broke a figurine. Item ID: " + item.GetLogString() + " FigExp: " + item.figExp.ToString(), Utils.LogType.ItemFigurineUse); } else { Rules.SpawnFigurine(item, cell, chr); } } else { Rules.SpawnFigurine(item, cell, chr); } } #endregion #region else if fragile else if (item.fragile) { int breakRoll = Rules.RollD(1, 100); // increase chance to break with every 20 feet dropped if (totalHeight > 0) { breakRoll -= Convert.ToInt32(totalHeight / 20); } if (item is SoulGem) { breakRoll -= 100; } if (cell != null) { // 25% chance to break if (breakRoll > 25) { cell.Add(item); } else { cell.SendShout("something shatter into pieces."); cell.EmitSound(Sound.GetCommonSound(Sound.CommonSound.BreakingGlass)); } } } #endregion else if (cell != null) { cell.Add(item); } } if (rightHand) { chr.UnequipRightHand(item); } else { chr.UnequipLeftHand(item); } #endregion return(true); }