public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Power Word Kill OnSpellEffect"); var target = spell.Targets[0]; // If target has over 100 hit points, spell fails if (target.Object.GetStat(Stat.hp_current) > 100) { target.Object.FloatMesFileLine("mes/spell.mes", 32000); AttachParticles("Fizzle", target.Object); } else { // Otherwise, the target dies. Simple. // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target.Object))) { target.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } target.Object.KillWithDeathEffect(); } spell.RemoveTarget(target.Object); spell.EndSpell(); }
public override bool OnHeartbeat(GameObject attachee, GameObject triggerer) { if ((GetGlobalVar(765) == 1 || GetGlobalVar(765) == 2 || GetGlobalFlag(283))) { attachee.SetObjectFlag(ObjectFlag.OFF); return(SkipDefault); } else if (((attachee.GetMap() == 5002) && (GetGlobalVar(765) == 0) && (PartyAlignment != Alignment.LAWFUL_EVIL) && (GetGlobalFlag(977)) && (GetGlobalVar(710) == 3)) && !Co8Settings.DisableNewPlots && ((GetGlobalVar(450) & (1 << 11)) == 0)) { if (!SelectedPartyLeader.GetPartyMembers().Any(o => o.HasFollowerByName(8002)) && !SelectedPartyLeader.GetPartyMembers().Any(o => o.HasFollowerByName(8004)) && !SelectedPartyLeader.GetPartyMembers().Any(o => o.HasFollowerByName(8005)) && !SelectedPartyLeader.GetPartyMembers().Any(o => o.HasFollowerByName(8010))) { if (((!GetGlobalFlag(44)) && (!GetGlobalFlag(45)) && (!GetGlobalFlag(700)) && (GetGlobalFlag(37)) && (!GetGlobalFlag(283)))) { attachee.ClearObjectFlag(ObjectFlag.OFF); if ((!GameSystems.Combat.IsCombatActive())) { if ((is_better_to_talk(attachee, PartyLeader))) { StartTimer(2000, () => start_talking(attachee, triggerer)); DetachScript(); } } } } } return(RunDefault); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Finger of Death OnSpellEffect"); var damage_dice = Dice.Parse("3d6"); damage_dice = damage_dice.WithModifier(Math.Min(25, spell.casterLevel)); var target = spell.Targets[0]; AttachParticles("sp-Slay Living", target.Object); // damage target if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target.Object.FloatMesFileLine("mes/spell.mes", 30001); // saving throw succesful, damage target target.Object.DealSpellDamage(spell.caster, DamageType.Unspecified, damage_dice, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId); } else { target.Object.FloatMesFileLine("mes/spell.mes", 30002); // saving throw unsuccesful, kill target // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target.Object))) { target.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } target.Object.KillWithDeathEffect(); } spell.RemoveTarget(target.Object); spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Cloudkill OnSpellEffect"); spell.duration = 10 * spell.casterLevel; // added so you'll get awarded XP for the kill foreach (var target_item in spell.Targets) { if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item.Object))) { if ((target_item.Object.GetObjectFlags() & ObjectFlag.INVULNERABLE) == 0) { target_item.Object.SetObjectFlag(ObjectFlag.INVULNERABLE); target_item.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); target_item.Object.ClearObjectFlag(ObjectFlag.INVULNERABLE); } else { target_item.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } } } // spawn one Cloudkill scenery object var cloudkill_obj = GameSystems.MapObject.CreateObject(OBJECT_SPELL_GENERIC, spell.aoeCenter); // add to d20initiative var caster_init_value = spell.caster.GetInitiative(); cloudkill_obj.InitD20Status(); cloudkill_obj.SetInitiative(caster_init_value); // put sp-cloudkill_obj condition on obj var cloudkill_obj_partsys_id = AttachParticles("sp-Cloudkill", cloudkill_obj); cloudkill_obj.AddCondition("sp-Cloudkill", spell.spellId, spell.duration, 0, cloudkill_obj_partsys_id); }
public static bool equip_transfer2(GameObject attachee, GameObject triggerer) { if (SelectedPartyLeader.GetPartyMembers().Any(o => o.HasItemByName(2201))) { Utilities.party_transfer_to(attachee, 2201); } return(RunDefault); }
public static void give_a_ton() { foreach (var obj in SelectedPartyLeader.GetPartyMembers()) { var curxp = obj.GetStat(Stat.experience); var newxp = curxp + 100; obj.SetBaseStat(Stat.experience, newxp); obj.FloatMesFileLine("mes/narrative.mes", 1010); } return; }
public static void run_off(GameObject npc, GameObject pc) { foreach (var obj in ObjList.ListVicinity(npc.GetLocation(), ObjectListFilter.OLC_NPC)) { if ((obj.GetLeader() == null && !((SelectedPartyLeader.GetPartyMembers()).Contains(obj)))) { obj.RunOff(); } } return; }
public static bool all_run_off(GameObject attachee, GameObject triggerer) { foreach (var obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC)) { if ((obj.GetLeader() == null && !((SelectedPartyLeader.GetPartyMembers()).Contains(obj)))) { obj.RunOff(); } } return(RunDefault); }
public static bool party_too_far_from_lareth(GameObject lareth) { foreach (var pc in SelectedPartyLeader.GetPartyMembers()) { if (pc.GetLocation().locx <= 495 || lareth.DistanceToInFeetClamped(pc) <= 42) { return(false); } } return(true); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Wail of the Banshee OnSpellEffect"); var remove_list = new List <GameObject>(); var banshee_targets = spell.casterLevel; AttachParticles("sp-Shout", spell.caster); SpawnParticles("sp-Dispel Magic - Area", spell.aoeCenter); foreach (var target_item in spell.Targets) { if (banshee_targets > 0) { // make sure target is alive if (target_item.Object.IsMonsterCategory(MonsterCategory.construct) || target_item.Object.IsMonsterCategory(MonsterCategory.undead)) { // not alive AttachParticles("Fizzle", target_item.Object); } else { // allow Fortitude saving throw to negate if (target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw successful target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); } else { // saving throw unsuccessful target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); // kill target AttachParticles("sp-Shout-Hit", target_item.Object); AttachParticles("sp-Death Knell-Target", target_item.Object); // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item.Object))) { target_item.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } target_item.Object.Kill(); } banshee_targets = banshee_targets - 1; } } remove_list.Add(target_item.Object); } spell.RemoveTargets(remove_list); spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Dismissal OnSpellEffect"); var target_item = spell.Targets[0]; spell.duration = 0; // spell.dc is DC - target's HD + caster's caster_level spell.dc = spell.dc - GameSystems.Critter.GetHitDiceNum(target_item.Object) + spell.casterLevel; spell.dc = Math.Max(1, spell.dc); if ((target_item.Object.type == ObjectType.npc)) { if (target_item.Object.HasCondition(SpellEffects.SpellSummoned) || target_item.Object.IsMonsterCategory(MonsterCategory.outsider)) { // allow Will saving throw to negate if (target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw successful target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); } else { // saving throw unsuccessful target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); // creature is sent back to its own plane (no 20% of wrong plane, DUMB) // kill for now // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item.Object))) { target_item.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } target_item.Object.Kill(); AttachParticles("sp-Dismissal", target_item.Object); } } else { // target is not EXTRAPLANAR target_item.Object.FloatMesFileLine("mes/spell.mes", 31007); AttachParticles("Fizzle", target_item.Object); } } else { // target is not an NPC AttachParticles("Fizzle", target_item.Object); } spell.RemoveTarget(target_item.Object); spell.EndSpell(); }
public override bool OnEnterCombat(GameObject attachee, GameObject triggerer) { if ((attachee.GetMap() != 5044)) { foreach (var pc in SelectedPartyLeader.GetPartyMembers()) { attachee.AIRemoveFromShitlist(pc); attachee.SetReaction(pc, 80); } } return(RunDefault); }
public static void earth_attack_party(GameObject pc, GameObject npc) { if (npc.GetNameId() == 14915) { StartTimer(100, () => destroy_npc(npc), true); } foreach (var obj in ObjList.ListVicinity(pc.GetLocation(), ObjectListFilter.OLC_NPC)) { if (!((SelectedPartyLeader.GetPartyMembers()).Contains(obj)) && obj.GetNameId() != 14914 && obj.GetNameId() != 14915) { obj.Attack(pc); } } return; }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Undeath to Death OnSpellEffect"); var remove_list = new List <GameObject>(); var kill_roll = Dice.D4; kill_roll = kill_roll.WithCount(Math.Min(20, spell.casterLevel)); var hit_dice_max = kill_roll.Roll(); foreach (var target_item in spell.Targets) { var obj_hit_dice = GameSystems.Critter.GetHitDiceNum(target_item.Object); // Only works on creatures of less than 9 hit dice, and only on undead if ((obj_hit_dice < 9) && (hit_dice_max >= obj_hit_dice) && (target_item.Object.IsMonsterCategory(MonsterCategory.undead))) { hit_dice_max = hit_dice_max - obj_hit_dice; // allow Will saving throw to negate if (target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw successful target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); } else { // saving throw unsuccessful target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item.Object))) { target_item.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } target_item.Object.Kill(); AttachParticles("sp-Holy Smite", target_item.Object); } } remove_list.Add(target_item.Object); } spell.RemoveTargets(remove_list); spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Weird OnSpellEffect"); var remove_list = new List <GameObject>(); var dice = Dice.Parse("3d6"); foreach (var target in spell.Targets) { remove_list.Add(target.Object); AttachParticles("sp-Phantasmal Killer", target.Object); // will save to negate, otherwise fort save to avoid death if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw successful target.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target.Object); } else if (target.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.SPELL_DESCRIPTOR_FEAR, spell.caster, spell.spellId)) { // fort save success, damage 3d6 target.Object.FloatMesFileLine("mes/spell.mes", 30001); // saving throw unsuccesful, damage target, full damage target.Object.DealSpellDamage(spell.caster, DamageType.Unspecified, dice, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId); } else { // fort save failure, kill target.Object.FloatMesFileLine("mes/spell.mes", 30002); // kill target // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target.Object))) { target.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } target.Object.Kill(); } } spell.RemoveTargets(remove_list); spell.EndSpell(); }
public override bool OnHeartbeat(GameObject attachee, GameObject triggerer) { if ((GetGlobalVar(765) == 1 || GetGlobalVar(765) == 2 || GetGlobalFlag(283))) { attachee.SetObjectFlag(ObjectFlag.OFF); return(SkipDefault); } else if (((attachee.GetMap() == 5002) && (GetGlobalVar(765) == 0) && (PartyAlignment != Alignment.LAWFUL_EVIL) && (GetGlobalFlag(977)) && (GetGlobalVar(710) == 3)) && !Co8Settings.DisableNewPlots && ((GetGlobalVar(450) & (1 << 11)) == 0)) { if (!SelectedPartyLeader.GetPartyMembers().Any(o => o.HasFollowerByName(8002)) && !SelectedPartyLeader.GetPartyMembers().Any(o => o.HasFollowerByName(8004)) && !SelectedPartyLeader.GetPartyMembers().Any(o => o.HasFollowerByName(8005)) && !SelectedPartyLeader.GetPartyMembers().Any(o => o.HasFollowerByName(8010))) { if (((!GetGlobalFlag(44)) && (!GetGlobalFlag(45)) && (!GetGlobalFlag(700)) && (GetGlobalFlag(37)) && (!GetGlobalFlag(283)))) { attachee.ClearObjectFlag(ObjectFlag.OFF); } } } attachee.SetScriptId(ObjScriptEvent.StartCombat, 2); // san_start_combat return(RunDefault); }
public bool OnStartCombat(GameObject attachee, GameObject triggerer, bool generated_from_timed_event_call, int talk_stage) { if (attachee.IsUnconscious()) { return(RunDefault); } // if !generated_from_timed_event_call and attachee.distance_to( party_closest(attachee) ) > 45: // attachee.move( party_closest(attachee).location, 0 , 0) // for pp in range(0, 41): // attachee.scripts[pp] = 998 // game.leader.ai_follower_add(attachee) // #game.timevent_add( lareth_abandon, (attachee, triggerer), 20, 1) var curr = attachee.GetStat(Stat.hp_current) - attachee.GetStat(Stat.subdual_damage); var maxx = attachee.GetStat(Stat.hp_max); var xx = attachee.GetLocation() & (65535); var hp_percent_lareth = 100 * curr / maxx; var ggv400 = GetGlobalVar(400); var ggv401 = GetGlobalVar(401); var pad3 = attachee.GetInt(obj_f.npc_pad_i_3); if ((attachee.GetMap() == 5005) && (party_too_far_from_lareth(attachee)) && !generated_from_timed_event_call) { if (((pad3 & 0x4) == 0)) { // Delay for one round, letting him cast Shield of Faith - he'll need it :) pad3 |= 0x4; attachee.SetInt(obj_f.npc_pad_i_3, pad3); return(RunDefault); } // Party is too far from Lareth, gotta nudge him in the right direction // spawn a beacon and change Lareth's strat to approach it locXY beacon_loc; if (xx > 478) { beacon_loc = new locXY(498, 550); } else { beacon_loc = new locXY(487, 540); } var obj_beacon = GameSystems.MapObject.CreateObject(14074, beacon_loc); obj_beacon.SetObjectFlag(ObjectFlag.DONTDRAW); obj_beacon.SetObjectFlag(ObjectFlag.CLICK_THROUGH); obj_beacon.Move(beacon_loc, 0, 0); obj_beacon.SetBaseStat(Stat.dexterity, -30); obj_beacon.SetInt(obj_f.npc_pad_i_3, 0x100); obj_beacon.Attack(SelectedPartyLeader); obj_beacon.AddToInitiative(); attachee.SetInt(obj_f.pad_i_0, attachee.GetInt(obj_f.critter_strategy)); // Record original strategy attachee.SetInt(obj_f.critter_strategy, 80); // set Lareth's strat to "seek beacon" var grease_detected = false; foreach (var spell_obj in ObjList.ListCone(attachee, ObjectListFilter.OLC_GENERIC, 40, 0, 360)) { // Check for active GREASE spell object if (spell_obj.GetInt(obj_f.secretdoor_dc) == 200 + (1 << 15)) { grease_detected = true; } } if (grease_detected) { // In case Lareth slips and doesn't execute his san_end_combat (wherein the beacon object is destroyed) - spawn a couple of timed events to guarantee the beacon doesn't survive StartTimer(3700, () => kill_beacon_obj(obj_beacon, attachee), true); StartTimer(3900, () => kill_beacon_obj(obj_beacon, attachee), true); } return(RunDefault); } // strategy 81 - Approach Party strategy if (attachee.GetInt(obj_f.critter_strategy) == 81 && !generated_from_timed_event_call) { if (ScriptDaemon.can_see_party(attachee)) { attachee.SetInt(obj_f.critter_strategy, 82); } } if (attachee.GetInt(obj_f.critter_strategy) != 81 && !generated_from_timed_event_call) { // Should Lareth cast Obscuring Mist? // First, find closest party member - the most likely target for an archer var closest_pc_1 = SelectedPartyLeader; foreach (var pc in PartyLeader.GetPartyMembers()) { if (pc.DistanceTo(attachee) < closest_pc_1.DistanceTo(attachee)) { closest_pc_1 = pc; } } // Then, check for spell objects with the Obscuring Mist ID, which are also identified as active var player_in_obscuring_mist = 0; foreach (var spell_obj in ObjList.ListCone(closest_pc_1, ObjectListFilter.OLC_GENERIC, 30, 0, 360)) { if (spell_obj.GetInt(obj_f.secretdoor_dc) == 333 + (1 << 15) && spell_obj.DistanceTo(closest_pc_1) <= 17.5f) { player_in_obscuring_mist = 1; } } var player_cast_web = false; var player_cast_entangle = false; foreach (var spell_obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_GENERIC)) { if (spell_obj.GetInt(obj_f.secretdoor_dc) == 531 + (1 << 15)) { player_cast_web = true; } if (spell_obj.GetInt(obj_f.secretdoor_dc) == 153 + (1 << 15)) { player_cast_entangle = true; } } // Assess level of ranged weapon threat var ranged_threat = 0; foreach (var pc in PartyLeader.GetPartyMembers()) { var pc_weap = pc.ItemWornAt(EquipSlot.WeaponPrimary).GetInt(obj_f.weapon_type); if ((new[] { 14, 17, 46, 48, 68 }).Contains(pc_weap) && !pc.IsUnconscious()) { // 14 - light crossbow // 17 - heavy crossbow // 46 - shortbow // 48 - longbow // 68 - repeating crossbow if (ranged_threat == 0) { ranged_threat = 1; } if (pc.HasFeat(FeatId.POINT_BLANK_SHOT) || (pc.GetStat(Stat.level_fighter) + pc.GetStat(Stat.level_ranger)) >= 1) { if (ranged_threat < 2) { ranged_threat = 2; } } if (pc.HasFeat(FeatId.PRECISE_SHOT) && (pc.GetStat(Stat.level_fighter) + pc.GetStat(Stat.level_ranger)) >= 1) { if (ranged_threat < 3) { ranged_threat = 3; } } } } if ((attachee.GetMap() == 5005 && xx > 478) && (((ggv401 >> 25) & 3) == 0) && ((ranged_threat == 3) || (ranged_threat > 1 && player_in_obscuring_mist == 1) || (ranged_threat > 0 && (player_cast_entangle || player_cast_web)))) { // Cast Obscuring Mist, if: // 1. Haven't cast it yet - (ggv401 >> 25) & 3 // 2. Ranged threat exists (emphasized when player casts web or is in obscuring mist) // Give him a potion of Obscuring Mist, to simulate him having that scroll (just like I do...) if (attachee.FindItemByProto(8899) == null) { attachee.GetItem(GameSystems.MapObject.CreateObject(8899, attachee.GetLocation())); } ggv401 += 1 << 25; SetGlobalVar(401, ggv401); var lareth_is_threatened = 0; if (closest_pc_1.DistanceTo(attachee) <= 3) { lareth_is_threatened = 1; } if (lareth_is_threatened == 1) { attachee.SetInt(obj_f.critter_strategy, 85); // Obscuring Mist + 5ft step } else { attachee.SetInt(obj_f.critter_strategy, 86); // Just Obscuring Mist } } else if (((pad3 & (2)) == 0) && (player_cast_entangle || player_cast_web)) { attachee.SetInt(obj_f.critter_strategy, 87); // Dispel strat pad3 |= (2); attachee.SetInt(obj_f.npc_pad_i_3, pad3); } else if (attachee.GetMap() == 5005 && player_entrenched_in_corridor(attachee)) { attachee.SetInt(obj_f.critter_strategy, 89); } else { attachee.SetInt(obj_f.critter_strategy, 82); } } if ((hp_percent_lareth < 50) && (!generated_from_timed_event_call || generated_from_timed_event_call && talk_stage == 667)) { if ((ggv400 & (0x40)) == 0) { GameObject found_pc = null; var obj_list = new List <GameObject>(); using var firstList = ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC); obj_list.AddRange(firstList); // Extending the range a little... foreach (var obj in ObjList.ListVicinity(attachee.GetLocation().OffsetTiles(-35, 0), ObjectListFilter.OLC_NPC)) { if (!((obj_list).Contains(obj))) { obj_list.Add(obj); } } foreach (var obj in ObjList.ListVicinity(attachee.GetLocation().OffsetTiles(35, 0), ObjectListFilter.OLC_NPC)) { if (!((obj_list).Contains(obj))) { obj_list.Add(obj); } } foreach (var obj in obj_list) { foreach (var pc in SelectedPartyLeader.GetPartyMembers()) { if (pc.type == ObjectType.pc && !pc.IsUnconscious()) { found_pc = pc; } obj.AIRemoveFromShitlist(pc); obj.SetReaction(pc, 50); obj.RemoveFromInitiative(); if (pc.type == ObjectType.npc) { pc.AIRemoveFromShitlist(obj); } } foreach (var obj2 in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_ALL)) { if (obj2.type == ObjectType.pc || obj2.type == ObjectType.npc) { obj2.SetReaction(obj, 50); try { obj2.AIRemoveFromShitlist(obj); } finally { var dummy = 1; } obj2.RemoveFromInitiative(); } } } if (!generated_from_timed_event_call) { StartTimer(100, () => OnStartCombat(attachee, triggerer, true, 667), true); } else if (found_pc != null) { ggv400 |= 0x40; SetGlobalVar(400, ggv400); SetGlobalFlag(834, true); found_pc.BeginDialog(attachee, 160); return(SkipDefault); } } } else if (!generated_from_timed_event_call && !GetGlobalFlag(834)) { if (((ggv401 >> 15) & 7) == 0) { ggv401 += 1 << 15; SetGlobalVar(401, ggv401); } else if (((ggv401 >> 15) & 7) == 1) { var closest_distance_1 = SelectedPartyLeader.DistanceTo(attachee); foreach (var pc in GameSystems.Party.PartyMembers) { closest_distance_1 = Math.Min(closest_distance_1, pc.DistanceTo(attachee)); } if (closest_distance_1 < 45) { for (var ppq = 3; ppq < 26; ppq++) { StartTimer(ppq * 2500 + RandomRange(0, 20), () => OnStartCombat(attachee, triggerer, true, ppq), true); } ggv401 += 1 << 15; SetGlobalVar(401, ggv401); } } } else if (generated_from_timed_event_call && !GetGlobalFlag(834)) { if ((hp_percent_lareth > 75) && (ggv400 & 0x10) == 0 && !attachee.D20Query(D20DispatcherKey.QUE_Prone)) { if (talk_stage >= 3 && ((ggv401 >> 15) & 31) == 2) { attachee.FloatLine(6000, triggerer); Sound(4201, 1); Sound(4201, 1); ggv401 += 1 << 15; SetGlobalVar(401, ggv401); } else if (talk_stage >= 3 && ((ggv401 >> 15) & 31) == 3) { Sound(4202, 1); Sound(4202, 1); ggv401 += 1 << 15; SetGlobalVar(401, ggv401); } else if (talk_stage >= 3 && ((ggv401 >> 15) & 31) == 4) { Sound(4203, 1); Sound(4203, 1); ggv401 += 1 << 15; SetGlobalVar(401, ggv401); } else if (talk_stage >= 8 && ((ggv401 >> 15) & 31) == 5) { attachee.FloatLine(6001, triggerer); Sound(4204, 1); Sound(4204, 1); ggv401 += 1 << 15; SetGlobalVar(401, ggv401); } else if (talk_stage >= 8 && ((ggv401 >> 15) & 31) == 6) { Sound(4205, 1); Sound(4205, 1); ggv401 += 1 << 15; SetGlobalVar(401, ggv401); } else if (talk_stage >= 13 && ((ggv401 >> 15) & 31) == 7) { attachee.FloatLine(6002, triggerer); Sound(4206, 1); Sound(4206, 1); ggv401 += 1 << 15; SetGlobalVar(401, ggv401); } else if (talk_stage >= 13 && ((ggv401 >> 15) & 31) == 8) { Sound(4207, 1); Sound(4207, 1); ggv401 += 1 << 15; SetGlobalVar(401, ggv401); } else if (talk_stage >= 18 && ((ggv401 >> 15) & 31) == 9) { attachee.FloatLine(6003, triggerer); Sound(4208, 1); Sound(4208, 1); ggv401 += 1 << 15; SetGlobalVar(401, ggv401); } else if (talk_stage >= 18 && ((ggv401 >> 15) & 31) == 10) { Sound(4209, 1); Sound(4209, 1); ggv401 += 1 << 15; SetGlobalVar(401, ggv401); } else if (talk_stage >= 22 && ((ggv401 >> 15) & 31) == 11) { attachee.FloatLine(6004, triggerer); Sound(4210, 1); Sound(4210, 1); ggv401 += 1 << 15; SetGlobalVar(401, ggv401); } else if (talk_stage >= 22 && ((ggv401 >> 15) & 31) == 12) { attachee.FloatLine(6004, triggerer); Sound(4211, 1); Sound(4211, 1); ggv401 += 1 << 15; SetGlobalVar(401, ggv401); } else if (talk_stage >= 22 && ((ggv401 >> 15) & 31) == 13) { attachee.FloatLine(6004, triggerer); Sound(4212, 1); Sound(4212, 1); ggv401 += 1 << 15; SetGlobalVar(401, ggv401); } } else if ((hp_percent_lareth <= 75) && (ggv400 & 0x10) == 0) { if (((ggv401 >> 15) & 31) > 2) { attachee.FloatLine(6005, triggerer); Sound(4200, 1); Sound(4200, 1); } StartTimer(5500, () => OnStartCombat(attachee, triggerer, true, 667), true); ggv400 |= 0x10; SetGlobalVar(400, ggv400); } } // Spiritual Weapon Shenanigens # CombatStandardRoutines.Spiritual_Weapon_Begone(attachee); return(RunDefault); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Death Knell OnSpellEffect"); var target_item = spell.Targets[0]; var npc = spell.caster; // added so NPC's will choose valid targets if (npc.type != ObjectType.pc && npc.GetLeader() == null) { foreach (var pc in GameSystems.Party.PartyMembers) { var curr = pc.GetStat(Stat.hp_current); if ((curr <= 0 && curr >= -9 && pc.DistanceTo(npc) <= 10)) { target_item.Object = pc; } } } if (npc.GetNameId() == 14609) { spell.casterLevel = 8; } if (npc.GetNameId() == 14601) { spell.casterLevel = 4; } spell.duration = 100 * GameSystems.Critter.GetHitDiceNum(target_item.Object); if (target_item.Object.GetStat(Stat.hp_current) < 0) { if (!target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw unsuccessful target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); // target_item.obj.condition_add_with_args( 'sp-Death Knell', spell.id, spell.duration, 2 ) spell.caster.FloatMesFileLine("mes/spell.mes", 20023); spell.caster.AddCondition("sp-Death Knell", spell.spellId, spell.duration, 2); // 2 is STR bonus // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item.Object))) { target_item.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } target_item.Object.KillWithDeathEffect(); target_item.ParticleSystem = AttachParticles("sp-Death Knell", target_item.Object); } else { // saving throw successful target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } } else { // target's hp_cur is >= 0 target_item.Object.FloatMesFileLine("mes/spell.mes", 31006); AttachParticles("Fizzle", target_item.Object); spell.RemoveTarget(target_item.Object); } spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Blasphemy OnSpellEffect"); var remove_list = new List <GameObject>(); // The Will save versus banishment is at a -4 penalty spell.dc = spell.dc + 4; var npc = spell.caster; var npc_caster_level = spell.casterLevel; if (npc.GetNameId() == 14286 || npc.GetNameId() == 14358) // Balors { npc_caster_level = 20; spell.dc = 25 + 4; // only affects banishment anyway } foreach (var target_item in spell.Targets) { var obj_hit_dice = GameSystems.Critter.GetHitDiceNum(target_item.Object); // Only works on non-evil creatures var alignment = target_item.Object.GetAlignment(); if (!(alignment.IsEvil()) && !(npc == target_item.Object)) { AttachParticles("sp-Slay Living", target_item.Object); // Anything ten or more levels below the caster's level dies if (obj_hit_dice <= (npc_caster_level - 10)) { // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item.Object))) { target_item.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } target_item.Object.Kill(); } // Anything five or more levels below the caster's level is paralyzed if (obj_hit_dice <= (npc_caster_level - 5)) { spell.duration = RandomRange(1, 10) * 10; target_item.Object.AddCondition("sp-Hold Monster", spell.spellId, spell.duration, 0); } // Anything one or more levels below the caster's level is weakened if (obj_hit_dice <= (npc_caster_level - 1)) { spell.duration = RandomRange(1, 4) + RandomRange(1, 4); var dam_amount = RandomRange(1, 6) + RandomRange(1, 6); target_item.Object.AddCondition("sp-Ray of Enfeeblement", spell.spellId, spell.duration, dam_amount); } // Anything the caster's level or below is dazed if (obj_hit_dice <= (npc_caster_level)) { spell.duration = 1; target_item.Object.AddCondition("sp-Daze", spell.spellId, spell.duration, 0); // Summoned and extraplanar creatures below the caster's level are also banished // if they fail a Will save at -4 if (target_item.Object.HasCondition(SpellEffects.SpellSummoned) || (target_item.Object.GetNpcFlags() & NpcFlag.EXTRAPLANAR) != 0) { // allow Will saving throw to negate if (target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw successful target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); } else { // saving throw unsuccessful target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); // creature is sent back to its own plane // kill for now target_item.Object.Kill(); } } } } remove_list.Add(target_item.Object); } // f.close() spell.RemoveTargets(remove_list); spell.EndSpell(); }
public override bool OnHeartbeat(GameObject attachee, GameObject triggerer) { attachee.SetScriptId(ObjScriptEvent.EnterCombat, 109); // assign enter_combat script if ((GameSystems.Combat.IsCombatActive())) { if ((attachee != null && !attachee.IsUnconscious() && !attachee.D20Query(D20DispatcherKey.QUE_Prone))) { run_off(attachee, triggerer); return(SkipDefault); } } if ((!GameSystems.Combat.IsCombatActive() && ScriptDaemon.tpsts("dala_buggered_off", 1))) { var downed_bozos = 0; foreach (var hostel_patron in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC)) { if ((new[] { 8018, 14145, 14074 }).Contains(hostel_patron.GetNameId())) { if (hostel_patron.IsUnconscious() || hostel_patron.GetLeader() != null) { downed_bozos += 1; } } } if (downed_bozos >= 2) { // attachee.float_mesfile_line( 'mes\\test.mes', 1, 0 ) attachee.FadeTo(255, 1, 50); foreach (var hostel_patron in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC)) { foreach (var pc in SelectedPartyLeader.GetPartyMembers()) { hostel_patron.AIRemoveFromShitlist(pc); hostel_patron.SetReaction(pc, 80); } } attachee.ClearObjectFlag(ObjectFlag.CLICK_THROUGH); attachee.ClearObjectFlag(ObjectFlag.OFF); foreach (var hostel_patron in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC)) { foreach (var pc in SelectedPartyLeader.GetPartyMembers()) { hostel_patron.AIRemoveFromShitlist(pc); hostel_patron.SetReaction(pc, 80); } } attachee.SetBaseStat(Stat.strength, 10); if (!ScriptDaemon.get_f("have_talked_to_dala_post_battle")) // initiate Dala monologue where she faints { foreach (var pc in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_PC)) { if (ScriptDaemon.is_safe_to_talk_rfv(attachee, pc, 40)) { ScriptDaemon.set_f("have_talked_to_dala_post_battle"); pc.BeginDialog(attachee, 200); } } } } } else if ((!GameSystems.Combat.IsCombatActive())) // this takes care of the infinite battle loop { // attachee.float_mesfile_line( 'mes\\test.mes', 2, 0 ) foreach (var hostel_patron in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_NPC)) { if (!((new[] { 8018, 14145, 14074 }).Contains(hostel_patron.GetNameId()))) // added condition because apparently sometimes combat doesn't start before this heartbeat fires and thus it sets them to non-hostile status and no combat actually commences { foreach (var pc in SelectedPartyLeader.GetPartyMembers()) { hostel_patron.AIRemoveFromShitlist(pc); hostel_patron.SetReaction(pc, 80); } } } } if ((GetQuestState(37) == QuestState.Completed)) { // game.new_sid = 0 # commented by S.A. - the heartbeat is now needed var dummy = 1; } else if ((!GetGlobalFlag(89))) { if ((!GameSystems.Combat.IsCombatActive())) { var(xx, yy) = attachee.GetLocation(); if (xx == 478 && yy == 504 && !attachee.HasLineOfSight(SelectedPartyLeader)) { attachee.TurnTowards(SelectedPartyLeader); } foreach (var obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_PC)) { if ((attachee.HasLineOfSight(obj))) { SetGlobalFlag(89, true); StartTimer(7200000, () => reset_global_flag_89(attachee)); // call reset_global_flag_89 in 2 hours attachee.StealFrom(obj); return(RunDefault); } } } } return(RunDefault); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Destruction OnSpellEffect"); var dam = Dice.Parse("10d6"); spell.duration = 0; // changed_con = 0 var target_item = spell.Targets[0]; // determine focus var focus = 0; if ((spell.caster.type != ObjectType.pc) && (spell.caster.GetLeader() == null)) { // for NPCs not in game party focus = 1; } else { if (spell.caster.GetMoney() >= 50000) { focus = 1; } } // check for focus if (focus == 1) { AttachParticles("sp-Disintegrate-Hit", target_item.Object); if ((target_item.Object.GetNameId() == 14629 || target_item.Object.GetNameId() == 14621 || target_item.Object.GetNameId() == 14604) && !Co8.is_spell_flag_set(target_item.Object, Co8SpellFlag.FlamingSphere)) { SpawnParticles("sp-Stoneskin", target_item.Object.GetLocation()); target_item.Object.Destroy(); } else if (target_item.Object.IsMonsterCategory(MonsterCategory.construct) || target_item.Object.IsMonsterCategory(MonsterCategory.undead)) { AttachParticles("Fizzle", target_item.Object); } // if target_item.obj.stat_base_get(stat_constitution) < 0: // target_item.obj.stat_base_set(stat_constitution, 10) // changed_con = 1 else if ((target_item.Object.type == ObjectType.pc) || (target_item.Object.type == ObjectType.npc)) { if (target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); target_item.Object.DealSpellDamage(spell.caster, DamageType.Force, dam, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId); } else { // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item.Object))) { target_item.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } target_item.Object.KillWithDeathEffect(); target_item.Object.AddCondition("sp-Animate Dead", spell.spellId, spell.duration, 3); AttachParticles("sp-Stoneskin", target_item.Object); } } else { target_item.Object.FloatMesFileLine("mes/spell.mes", 30003); AttachParticles("Fizzle", target_item.Object); } } else { // no focus spell.caster.FloatMesFileLine("mes/spell.mes", 16009); } // if changed_con == 1: // target_item.obj.stat_base_set(stat_constitution, -1) spell.RemoveTarget(target_item.Object); spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Banishment OnSpellEffect"); var remove_list = new List <GameObject>(); spell.duration = 0; var hitDiceAmount = 2 * spell.casterLevel; var banish_casterLV = spell.casterLevel; // check for any item that is distasteful to the subjects (Needs suggestions) var bonus1_list = new[] { 8028 }; // Potion of Protection From Outsiders foreach (var bonus1 in bonus1_list) { if (spell.caster.FindItemByName(bonus1) != null) { spell.dc = spell.dc + 2; // the saving throw DC increases by 2 } } // does NOT work! (Needs a fix.) // spell.caster_level = spell.caster_level + 1 ## +1 bonus on your caster level check for overcoming Spell Resistance // check for rare items that work twice as well as a normal item for the purpose of the bonuses (Needs suggestions) var bonus2_list = new[] { 12900 }; // Swamp Lotus foreach (var bonus2 in bonus2_list) { if (spell.caster.FindItemByName(bonus2) != null) { spell.dc = spell.dc + 4; // the saving throw DC increases by 4 } } // does NOT work! (Needs a fix.) // spell.caster_level = spell.caster_level + 2 ## +2 bonus on your caster level check for overcoming Spell Resistance var spell_dc = spell.dc; foreach (var target_item in spell.Targets) { // check critter hit dice var targetHitDice = GameSystems.Critter.GetHitDiceNum(target_item.Object); // check if target does not exceed the amount allowed if (hitDiceAmount >= targetHitDice) { // spell.dc is DC - target's HD + caster's caster_level spell.dc = spell_dc - targetHitDice + banish_casterLV; spell.dc = Math.Max(1, spell.dc); if ((target_item.Object.type == ObjectType.npc)) { // check target is EXTRAPLANAR if (target_item.Object.HasCondition(SpellEffects.SpellSummoned) || target_item.Object.IsMonsterCategory(MonsterCategory.outsider) || target_item.Object.IsMonsterSubtype(MonsterSubtype.extraplanar)) { // subtract the target's hit dice from the amount allowed hitDiceAmount = hitDiceAmount - targetHitDice; // allow Will saving throw to negate if (target_item.Object.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw successful target_item.Object.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item.Object); } else { // saving throw unsuccessful target_item.Object.FloatMesFileLine("mes/spell.mes", 30002); // creature is sent back to its own plane (no 20% of wrong plane, DUMB) // kill for now // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item.Object))) { target_item.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } target_item.Object.Kill(); if (target_item.Object.HasCondition(SpellEffects.SpellSummoned)) { SpawnParticles("sp-Dismissal", target_item.Object.GetLocation()); target_item.Object.Destroy(); } else { AttachParticles("sp-Dismissal", target_item.Object); target_item.Object.AddCondition("sp-Animate Dead", spell.spellId, spell.duration, 3); } } } else { // target is not EXTRAPLANAR target_item.Object.FloatMesFileLine("mes/spell.mes", 31007); AttachParticles("Fizzle", target_item.Object); } } else { // target is not an NPC AttachParticles("Fizzle", target_item.Object); } } else { // ran out of allowed HD AttachParticles("Fizzle", target_item.Object); } remove_list.Add(target_item.Object); } spell.RemoveTargets(remove_list); spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Prismatic Spray OnSpellEffect"); var remove_list = new List <GameObject>(); AttachParticles("sp-Prismatic Spray", spell.caster); var dam = Dice.Parse("1d1"); var npc = spell.caster; var effect1 = 0; spell.duration = 1000; // Caster is NOT in game party if (npc.type != ObjectType.pc && npc.GetLeader() == null) { var range = 60; var target_list = ObjList.ListCone(spell.caster, ObjectListFilter.OLC_CRITTERS, range, -30, 60); // get all targets in a 25ft + 2ft/level cone (60') var soundfizzle = 0; foreach (var t in target_list) { if (t == spell.caster) { continue; } var effect_list = new List <int>(); effect1 = RandomRange(1, 8); if (effect1 == 8) { effect_list.Add(RandomRange(1, 8)); effect_list.Add(RandomRange(1, 8)); } else { effect_list.Add(effect1); } if (effect_list.Count == 1) { if (effect_list[0] == 5 || effect_list[0] == 6) { } else { remove_list.Add(t); } } if (effect_list.Count == 2) { if (effect_list[0] == 5 || effect_list[0] == 6 || effect_list[1] == 5 || effect_list[1] == 6) { } else { remove_list.Add(t); } } foreach (var effect in effect_list) { if (effect == 1) { // 20 fire damage dam = dam.WithCount(20); var(xx, yy) = t.GetLocation(); if (t.GetMap() == 5067 && (xx >= 521 && xx <= 555) && (yy >= 560 && yy <= 610)) { // Water Temple Pool Enchantment prevents fire spells from working inside the chamber, according to the module -SA t.FloatMesFileLine("mes/skill_ui.mes", 2000, TextFloaterColor.Red); AttachParticles("swirled gas", t); soundfizzle = 1; } else { if (t.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, dam, DamageType.Fire, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId)) { // saving throw successful t.FloatMesFileLine("mes/spell.mes", 30001); } else { // saving throw unsuccessful t.FloatMesFileLine("mes/spell.mes", 30002); } } } else if (effect == 2) { // 40 acid damage dam = dam.WithCount(40); if (t.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, dam, DamageType.Acid, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId)) { // saving throw successful t.FloatMesFileLine("mes/spell.mes", 30001); } else { // saving throw unsuccessful t.FloatMesFileLine("mes/spell.mes", 30002); } } else if (effect == 3) { // 80 Electricity damage dam = dam.WithCount(80); if (t.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, dam, DamageType.Electricity, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId)) { // saving throw successful t.FloatMesFileLine("mes/spell.mes", 30001); } else { // saving throw unsuccessful t.FloatMesFileLine("mes/spell.mes", 30002); } } else if (effect == 4) { // poisoned no save = die save = 1-10 con damage if (!t.IsMonsterCategory(MonsterCategory.ooze) && !t.IsMonsterCategory(MonsterCategory.plant) && !t.IsMonsterCategory(MonsterCategory.undead)) { // if not t.saving_throw_spell( spell.dc, D20_Save_Fortitude, D20STD_F_NONE, spell.caster, spell.id ): // saving throw unsuccessful t.FloatMesFileLine("mes/spell.mes", 30002); t.KillWithDeathEffect(); // else: // saving throw successful var poison_index = 23; var time_to_secondary = 10; var poison_dc = 200; t.FloatMesFileLine("mes/spell.mes", 30001); t.AddCondition("Poisoned", poison_index, time_to_secondary, poison_dc); // t.condition.add_with_args( 'sp-Neutralize Poison', spell.id, spell.duration, 0 ) StartTimer(12000, () => end_poison(spell, t)); // don't want secondary damage here } } else if (effect == 5) { // turned to stone if (t.SavingThrow(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster)) { // saving throw successful t.FloatMesFileLine("mes/spell.mes", 30001); } else { // saving throw unsuccessful t.FloatMesFileLine("mes/spell.mes", 30002); // HTN - apply condition HALT (Petrified) t.AddCondition("sp-Command", spell.spellId, spell.duration, 4); AttachParticles("sp-Bestow Curse", t); } } else if (effect == 6) { // insane var dc = spell.dc; if (!t.SavingThrowSpell(dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { t.FloatMesFileLine("mes/spell.mes", 30002); t.AddCondition("sp-Confusion", spell.spellId, spell.duration, 1); } else { t.FloatMesFileLine("mes/spell.mes", 30001); } } } } if (soundfizzle == 1) { Sound(7581, 1); Sound(7581, 1); } } // Caster is in game party if (npc.type == ObjectType.pc || npc.GetLeader() != null) { var soundfizzle = 0; foreach (var t in spell.Targets) { var effect_list = new List <int>(); effect1 = RandomRange(1, 8); if (effect1 == 8) { effect_list.Add(RandomRange(1, 8)); effect_list.Add(RandomRange(1, 8)); } else { effect_list.Add(effect1); } if (effect_list.Count == 1) { if (effect_list[0] == 5 || effect_list[0] == 6) { } else { remove_list.Add(t.Object); } } if (effect_list.Count == 2) { if (effect_list[0] == 5 || effect_list[0] == 6 || effect_list[1] == 5 || effect_list[1] == 6) { } else { remove_list.Add(t.Object); } } foreach (var effect in effect_list) { if (effect == 1) { // 20 fire damage dam = dam.WithCount(20); var(xx, yy) = t.Object.GetLocation(); if (t.Object.GetMap() == 5067 && (xx >= 521 && xx <= 555) && (yy >= 560 && yy <= 610)) { // Water Temple Pool Enchantment prevents fire spells from working inside the chamber, according to the module -SA t.Object.FloatMesFileLine("mes/skill_ui.mes", 2000, TextFloaterColor.Red); AttachParticles("swirled gas", t.Object); soundfizzle = 1; } else { if (t.Object.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, dam, DamageType.Fire, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId)) { // saving throw successful t.Object.FloatMesFileLine("mes/spell.mes", 30001); } else { // saving throw unsuccessful t.Object.FloatMesFileLine("mes/spell.mes", 30002); } } } else if (effect == 2) { // 40 acid damage dam = dam.WithCount(40); if (t.Object.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, dam, DamageType.Acid, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId)) { // saving throw successful t.Object.FloatMesFileLine("mes/spell.mes", 30001); } else { // saving throw unsuccessful t.Object.FloatMesFileLine("mes/spell.mes", 30002); } } else if (effect == 3) { // 80 Electricity damage dam = dam.WithCount(80); if (t.Object.ReflexSaveAndDamage(spell.caster, spell.dc, D20SavingThrowReduction.Half, D20SavingThrowFlag.NONE, dam, DamageType.Electricity, D20AttackPower.UNSPECIFIED, D20ActionType.CAST_SPELL, spell.spellId)) { // saving throw successful t.Object.FloatMesFileLine("mes/spell.mes", 30001); } else { // saving throw unsuccessful t.Object.FloatMesFileLine("mes/spell.mes", 30002); } } else if (effect == 4) { // poisoned no save = die save = 1-10 con damage if (!t.Object.IsMonsterCategory(MonsterCategory.ooze) && !t.Object.IsMonsterCategory(MonsterCategory.plant) && !t.Object.IsMonsterCategory(MonsterCategory.undead) && !t.Object.IsMonsterCategory(MonsterCategory.construct)) { if (!t.Object.SavingThrowSpell(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw unsuccessful t.Object.FloatMesFileLine("mes/spell.mes", 30002); // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(t.Object))) { t.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } t.Object.KillWithDeathEffect(); } else { // saving throw successful var poison_index = 23; var time_to_secondary = 10; var poison_dc = 200; t.Object.FloatMesFileLine("mes/spell.mes", 30001); t.Object.AddCondition("Poisoned", poison_index, time_to_secondary, poison_dc); StartTimer(6000, () => end_poison(spell, t.Object)); // don't want secondary damage here } } } else if (effect == 5) { // turned to stone if (t.Object.SavingThrow(spell.dc, SavingThrowType.Fortitude, D20SavingThrowFlag.NONE, spell.caster)) { // saving throw successful t.Object.FloatMesFileLine("mes/spell.mes", 30001); } else { // saving throw unsuccessful t.Object.FloatMesFileLine("mes/spell.mes", 30002); // HTN - apply condition HALT (Petrified) t.Object.AddCondition("sp-Command", spell.spellId, spell.duration, 4); AttachParticles("sp-Bestow Curse", t.Object); } } else if (effect == 6) { // insane var dc = spell.dc; if (!t.Object.SavingThrowSpell(dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { t.Object.FloatMesFileLine("mes/spell.mes", 30002); t.Object.AddCondition("sp-Confusion", spell.spellId, spell.duration, 1); } else { t.Object.FloatMesFileLine("mes/spell.mes", 30001); } } else if (effect == 7) { // sent to another plane- kill and destroy for now var dc = spell.dc; if (!t.Object.SavingThrowSpell(dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { t.Object.FloatMesFileLine("mes/spell.mes", 30002); // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(t.Object))) { t.Object.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } t.Object.KillWithDeathEffect(); t.Object.Destroy(); } else { t.Object.FloatMesFileLine("mes/spell.mes", 30001); } } } } if (soundfizzle == 1) { Sound(7581, 1); Sound(7581, 1); } } spell.RemoveTargets(remove_list); spell.EndSpell(); }
public override bool OnEnterCombat(GameObject attachee, GameObject triggerer) { if (SelectedPartyLeader.GetPartyMembers().Any(o => o.HasFollowerByName(8730))) { var ron = Utilities.find_npc_near(SelectedPartyLeader, 8730); if (ron != null) { SelectedPartyLeader.RemoveFollower(ron); } } if ((!GetGlobalFlag(816) && !GetGlobalFlag(818))) { SetGlobalFlag(818, true); foreach (var target in PartyLeader.GetPartyMembers()) { if ((target.GetNameId() != 8072 && attachee.DistanceTo(target) <= 20 && target.type == ObjectType.pc)) { attachee.TurnTowards(target); target.BeginDialog(attachee, 2000); return(SkipDefault); } } attachee.FloatLine(2010, triggerer); var terjonLoc = attachee.GetLocation(); terjonLoc.locx -= 4; var terjon = GameSystems.MapObject.CreateObject(14007, terjonLoc); AttachParticles("sp-Dimension Door", terjon); terjon.TurnTowards(attachee); var calmert = attachee.GetInitiative(); terjon.AddToInitiative(); terjon.SetInitiative(calmert); UiSystems.Combat.Initiative.UpdateIfNeeded(); terjon.Attack(triggerer); } foreach (var npc in PartyLeader.GetPartyMembers()) { if ((npc.GetNameId() == 8072 && npc.GetLeader() != null && !GetGlobalFlag(819))) { var curr = npc.GetStat(Stat.hp_current); if ((curr >= 1)) { foreach (var target in PartyLeader.GetPartyMembers()) { if ((target.GetNameId() != 8072 && npc.DistanceTo(target) <= 20 && target.type == ObjectType.pc)) { npc.TurnTowards(target); target.BeginDialog(npc, 1000); return(SkipDefault); } } } } } if (triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8000))) { var elmo = Utilities.find_npc_near(triggerer, 8000); if ((elmo != null)) { triggerer.RemoveFollower(elmo); elmo.FloatLine(12021, triggerer); elmo.Attack(triggerer); } } if (triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8001))) { var paida = Utilities.find_npc_near(triggerer, 8001); if ((paida != null)) { triggerer.RemoveFollower(paida); paida.FloatLine(12021, triggerer); paida.Attack(triggerer); } } if (triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8014))) { var otis = Utilities.find_npc_near(triggerer, 8014); if ((otis != null)) { triggerer.RemoveFollower(otis); otis.FloatLine(12021, triggerer); otis.Attack(triggerer); } } if (triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8015))) { var meleny = Utilities.find_npc_near(triggerer, 8015); if ((meleny != null)) { triggerer.RemoveFollower(meleny); meleny.FloatLine(12021, triggerer); meleny.Attack(triggerer); } } if (triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8021))) { var ydey = Utilities.find_npc_near(triggerer, 8021); if ((ydey != null)) { triggerer.RemoveFollower(ydey); ydey.FloatLine(12021, triggerer); ydey.Attack(triggerer); } } if (triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8022))) { var murfles = Utilities.find_npc_near(triggerer, 8022); if ((murfles != null)) { triggerer.RemoveFollower(murfles); murfles.FloatLine(12021, triggerer); murfles.Attack(triggerer); } } if (triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8031))) { var thrommel = Utilities.find_npc_near(triggerer, 8031); if ((thrommel != null)) { triggerer.RemoveFollower(thrommel); thrommel.FloatLine(12021, triggerer); thrommel.Attack(triggerer); } } if (triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8039))) { var taki = Utilities.find_npc_near(triggerer, 8039); if ((taki != null)) { triggerer.RemoveFollower(taki); taki.FloatLine(12021, triggerer); taki.Attack(triggerer); } } if (triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8054))) { var burne = Utilities.find_npc_near(triggerer, 8054); if ((burne != null)) { triggerer.RemoveFollower(burne); burne.FloatLine(12021, triggerer); burne.Attack(triggerer); } } if (triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8060))) { var morgan = Utilities.find_npc_near(triggerer, 8060); if ((morgan != null)) { triggerer.RemoveFollower(morgan); morgan.FloatLine(12021, triggerer); morgan.Attack(triggerer); } } if (triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8069))) { var pishella = Utilities.find_npc_near(triggerer, 8069); if ((pishella != null)) { triggerer.RemoveFollower(pishella); pishella.FloatLine(12021, triggerer); pishella.Attack(triggerer); } } if (triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8071))) { var rufus = Utilities.find_npc_near(triggerer, 8071); if ((rufus != null)) { triggerer.RemoveFollower(rufus); rufus.FloatLine(12021, triggerer); rufus.Attack(triggerer); } } if (triggerer.GetPartyMembers().Any(o => o.HasFollowerByName(8714))) { var holly = Utilities.find_npc_near(triggerer, 8714); if ((holly != null)) { triggerer.RemoveFollower(holly); holly.FloatLine(1000, triggerer); holly.Attack(triggerer); } } return(RunDefault); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Dictum OnSpellEffect"); var remove_list = new List <GameObject>(); // The Will save versus banishment is at a -4 penalty spell.dc = spell.dc + 4; // ff = open('dictum.txt', 'w') // ffs = '' var target_list = Utilities.pyspell_targetarray_copy_to_obj_list(spell); foreach (var target_item_obj in target_list) { var obj_hit_dice = GameSystems.Critter.GetHitDiceNum(target_item_obj); // Only works on non-lawful creatures var alignment = target_item_obj.GetAlignment(); if (!(alignment.IsLawful())) { AttachParticles("sp-Destroy Undead", target_item_obj); // Anything ten or more levels below the caster's level dies // ffs += '\n' + str(spell.caster_level) + '\n' + str(obj_hit_dice) + '\n' if (obj_hit_dice <= (spell.casterLevel - 10)) { // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item_obj))) { target_item_obj.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } target_item_obj.Kill(); } // Anything five or more levels below the caster's level is paralyzed if (obj_hit_dice <= (spell.casterLevel - 5)) { spell.duration = RandomRange(1, 10) * 10; target_item_obj.AddCondition("sp-Hold Monster", spell.spellId, spell.duration, 0); } // Anything one or more levels below the caster's level is slowed if (obj_hit_dice <= (spell.casterLevel - 1)) { spell.duration = RandomRange(1, 4) + RandomRange(1, 4); target_item_obj.AddCondition("sp-Slow", spell.spellId, spell.duration, 1); } // Anything the caster's level or below is deafened if (obj_hit_dice <= (spell.casterLevel)) { spell.duration = RandomRange(1, 4); target_item_obj.AddCondition("sp-Shout", spell.spellId, spell.duration, 0); // Summoned and extraplanar creatures below the caster's level are also banished // if they fail a Will save at -4 if (target_item_obj.HasCondition(SpellEffects.SpellSummoned) || (target_item_obj.GetNpcFlags() & NpcFlag.EXTRAPLANAR) != 0) { // ffs += 'Spell condition summoned: ' + str(target_item_obj.d20_query_has_spell_condition( sp_Summoned ) ) + '\nExtraplanar: ' + str(target_item_obj.npc_flags_get( ONF_EXTRAPLANAR )) + '\n' // allow Will saving throw to negate if (target_item_obj.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw successful target_item_obj.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item_obj); } else { // saving throw unsuccessful target_item_obj.FloatMesFileLine("mes/spell.mes", 30002); // creature is sent back to its own plane // kill for now // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item_obj))) { target_item_obj.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } target_item_obj.Kill(); } } } } remove_list.Add(target_item_obj); } // ff.write(ffs) // ff.close() spell.RemoveTargets(remove_list); spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Word of Chaos OnSpellEffect"); var remove_list = new List <GameObject>(); // The Will save versus banishment is at a -4 penalty spell.dc = spell.dc + 4; var npc = spell.caster; var npc_caster_level = spell.casterLevel; if (npc.GetNameId() == 14286 || npc.GetNameId() == 14358) // Balors { npc_caster_level = 20; spell.dc = 25 + 4; // only affects banishment anyway } // f = open('wordofchaos_feedback.txt', 'w') // f.write( 'ccc\n' ) var target_list = Utilities.pyspell_targetarray_copy_to_obj_list(spell); foreach (var target_item_obj in target_list) { // f.write( str(target_item_obj.name) + '\n' ) var obj_hit_dice = GameSystems.Critter.GetHitDiceNum(target_item_obj); var is_confused = 0; // Only works on non-chaotic creatures var alignment = target_item_obj.GetAlignment(); if (!(alignment.IsChaotic()) && !(npc == target_item_obj)) { AttachParticles("sp-Polymorph Other", target_item_obj); // Anything ten or more levels below the caster's level dies if (obj_hit_dice <= (npc_caster_level - 10)) { // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item_obj))) { target_item_obj.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } target_item_obj.Kill(); } // Anything five or more levels below the caster's level is confused if (obj_hit_dice <= (npc_caster_level - 5)) { spell.duration = RandomRange(1, 10) * 10; target_item_obj.FloatMesFileLine("mes/combat.mes", 113, TextFloaterColor.Red); target_item_obj.AddCondition("sp-Confusion", spell.spellId, spell.duration, 0); is_confused = 1; // added because Confusion will end when either the stun or deafness spell end (Confusion needs a fix.) } // Anything one or more levels below the caster's level is stunned if (obj_hit_dice <= (npc_caster_level - 1)) { if (is_confused == 0) // added because Confusion will end when the stun spell ends { spell.duration = 0; target_item_obj.AddCondition("sp-Color Spray Stun", spell.spellId, spell.duration, 0); } } // Anything the caster's level or below is deafened if (obj_hit_dice <= (npc_caster_level)) { if (is_confused == 0) // added because Confusion will end when the deafness spell ends { spell.duration = RandomRange(1, 4); target_item_obj.AddCondition("sp-Shout", spell.spellId, spell.duration, 0); } // Summoned and extraplanar creatures below the caster's level are also banished // if they fail a Will save at -4 if (target_item_obj.HasCondition(SpellEffects.SpellSummoned) || (target_item_obj.GetNpcFlags() & NpcFlag.EXTRAPLANAR) != 0) { // allow Will saving throw to negate if (target_item_obj.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw successful target_item_obj.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item_obj); } else { // saving throw unsuccessful target_item_obj.FloatMesFileLine("mes/spell.mes", 30002); // creature is sent back to its own plane // kill for now // So you'll get awarded XP for the kill if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item_obj))) { target_item_obj.Damage(SelectedPartyLeader, DamageType.Unspecified, Dice.Parse("1d1")); } target_item_obj.Kill(); } } } } remove_list.Add(target_item_obj); } // f.close() spell.RemoveTargets(remove_list); spell.EndSpell(); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Holy Word OnSpellEffect"); var remove_list = new List <GameObject>(); // The Will save versus banishment is at a -4 penalty spell.dc = spell.dc + 4; var obj_list = new List <GameObject>(); // extracting the obj's so we don't get changed iterator bullshit (see http://www.co8.org/community/index.php?threads/holy-word-killed-my-cg-pc.12164/#post-145537) foreach (var target_item in spell.Targets) { // Only works on non-good creatures var target_item_obj = target_item.Object; var alignment = target_item_obj.GetAlignment(); if (!(alignment.IsGood())) { obj_list.Add(target_item_obj); } remove_list.Add(target_item_obj); } // for target_item in spell.target_list: // target_item_obj = target_item.obj foreach (var target_item_obj in obj_list) { Logger.Info("{0}", "target item: " + target_item_obj.ToString()); var obj_hit_dice = GameSystems.Critter.GetHitDiceNum(target_item_obj); AttachParticles("sp-Holy Smite", target_item_obj); // Anything ten or more levels below the caster's level dies if (obj_hit_dice <= (spell.casterLevel - 10)) { if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item_obj))) { // print "Inflicting damage due to low critter HD: " + str(target_item_obj) target_item_obj.Damage(SelectedPartyLeader, DamageType.PositiveEnergy, Dice.Parse("52d52")); } // So you'll get awarded XP for the kill // print "Killing due to low critter HD: " + str(target_item_obj) target_item_obj.Kill(); } // Anything five or more levels below the caster's level is paralyzed if (obj_hit_dice <= (spell.casterLevel - 5)) { spell.duration = RandomRange(1, 10) * 10; target_item_obj.AddCondition("sp-Hold Monster", spell.spellId, spell.duration, 0); } // Anything one or more levels below the caster's level is blinded if (obj_hit_dice <= (spell.casterLevel - 1)) { spell.duration = RandomRange(1, 4) + RandomRange(1, 4); target_item_obj.AddCondition("sp-Blindness", spell.spellId, spell.duration, 0); } // Anything the caster's level or below is deafened if (obj_hit_dice <= (spell.casterLevel)) { spell.duration = RandomRange(1, 4); target_item_obj.AddCondition("sp-Deafness", spell.spellId, spell.duration, 0); // Summoned and extraplanar creatures below the caster's level are also banished // if they fail a Will save at -4 if (target_item_obj.HasCondition(SpellEffects.SpellSummoned) || (target_item_obj.GetNpcFlags() & NpcFlag.EXTRAPLANAR) != 0) { // allow Will saving throw to negate if (target_item_obj.SavingThrowSpell(spell.dc, SavingThrowType.Will, D20SavingThrowFlag.NONE, spell.caster, spell.spellId)) { // saving throw successful target_item_obj.FloatMesFileLine("mes/spell.mes", 30001); AttachParticles("Fizzle", target_item_obj); } else { // saving throw unsuccessful target_item_obj.FloatMesFileLine("mes/spell.mes", 30002); // creature is sent back to its own plane // kill for now if (!((SelectedPartyLeader.GetPartyMembers()).Contains(target_item_obj))) { // print "Inflicting damage due to Summoned/Extraplanar: " + str(target_item_obj) target_item_obj.Damage(SelectedPartyLeader, DamageType.PositiveEnergy, Dice.Parse("52d52")); } // So you'll get awarded XP for the kill // print "critter_kill due to Summoned or Extraplanar: " + str(target_item_obj) target_item_obj.Kill(); } } } } spell.RemoveTargets(remove_list); spell.EndSpell(); }