private bool GetTileScript(locXY tileLoc, out TileScript tileScript) { using var lockedSector = new LockedMapSector(new SectorLoc(tileLoc)); var sector = lockedSector.Sector; if (sector == null) { tileScript = default; return(false); } var tileIndex = sector.GetTileOffset(tileLoc); foreach (var scriptInSector in sector.tileScripts) { if (scriptInSector.tileIndex == tileIndex) { tileScript.Location = tileLoc; tileScript.Script.unk1 = scriptInSector.scriptUnk1; tileScript.Script.counters = scriptInSector.scriptCounters; tileScript.Script.scriptId = scriptInSector.scriptId; return(true); } else if (scriptInSector.tileIndex > tileIndex) { break; // Tiles are sorted in ascending order } } tileScript = default; return(false); }
public static bool run_off(GameObject attachee, GameObject triggerer) { var loc = new locXY(427, 406); attachee.RunOff(loc); return(RunDefault); }
public static bool leave_for_city(GameObject attachee, GameObject triggerer) { var loc = new locXY(625, 420); attachee.RunOff(loc); return(RunDefault); }
public override bool OnFirstHeartbeat(GameObject attachee, GameObject triggerer) { var loc = locXY.Zero; foreach (var statue in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_SCENERY)) { if ((statue.GetNameId() == 1618)) { loc = statue.GetLocation(); } } if (loc != locXY.Zero) { var spell_obj = GameSystems.MapObject.CreateObject(OBJECT_SPELL_GENERIC, loc); AttachParticles("sp-Fog Cloud", spell_obj); } loc = new locXY(543, 539); var spell_obj2 = GameSystems.MapObject.CreateObject(OBJECT_SPELL_GENERIC, loc); AttachParticles("sp-Fog Cloud", spell_obj2); loc = new locXY(528, 538); var spell_obj3 = GameSystems.MapObject.CreateObject(OBJECT_SPELL_GENERIC, loc); AttachParticles("sp-Fog Cloud", spell_obj3); DetachScript(); return(RunDefault); }
public override void OnSpellEffect(SpellPacketBody spell) { Logger.Info("Obscuring Mist OnSpellEffect"); spell.duration = 100 * spell.casterLevel; locXY locc_; if (spell.caster.GetNameId() == 8002 && SelectedPartyLeader.GetMap() == 5005) // Lareth in Moathouse { locc_ = new locXY(483, 534); } else { locc_ = spell.aoeCenter.location; } // spawn one spell_object object var spell_obj = GameSystems.MapObject.CreateObject(OBJECT_SPELL_GENERIC, locc_); // add to d20initiative var caster_init_value = spell.caster.GetInitiative(); spell_obj.InitD20Status(); spell_obj.SetInitiative(caster_init_value); // put sp-Obscuring Mist condition on obj var spell_obj_partsys_id = AttachParticles("sp-Obscuring Mist", spell_obj); spell_obj.AddCondition("sp-Obscuring Mist", spell.spellId, spell.duration, 0, spell_obj_partsys_id); // Added by Sitra Achara # spell_obj.SetInt(obj_f.secretdoor_dc, 333 + (1 << 15)); // Mark it as an "obscuring mist" object. // 1<<15 - marks it as "active" // bits 16 and onward - random ID number Co8PersistentData.AddToSpellActiveList(OBSCURING_MIST_KEY, spell.spellId, spell_obj); }
public override bool OnFirstHeartbeat(GameObject attachee, GameObject triggerer) { if ((GetGlobalFlag(341))) { foreach (var obj in ObjList.ListVicinity(attachee.GetLocation(), ObjectListFilter.OLC_SCENERY)) { if ((obj.GetNameId() == 1610)) { obj.ClearObjectFlag(ObjectFlag.DONTDRAW); } else if ((obj.GetNameId() == 1616)) { obj.Destroy(); } else if ((obj.GetNameId() == 1617)) { obj.Destroy(); } } var loc = new locXY(489, 396); var throne = GameSystems.MapObject.CreateObject(2090, loc); if ((throne != null)) { throne.Rotation = 2.3561945f; } attachee.Destroy(); } return(SkipDefault); }
public static bool run_off(GameObject attachee, GameObject triggerer) { var lfa = new locXY(492, 488); attachee.RunOff(lfa); return(RunDefault); }
public FrozenObjRef(ObjectId guid, locXY location, int mapNumber) : this() { this.guid = guid; this.location = location; this.mapNumber = mapNumber; padding = 0; }
public static bool run_off(GameObject attachee, GameObject triggerer) { attachee.SetStandpoint(StandPointType.Night, 255); var loc = new locXY(506, 493); attachee.RunOff(loc); return(RunDefault); }
private void BackOffInDirection(locXY start, CompassDirection relPosCode, int tiles, out locXY locOut) { locOut = start; for (int i = 0; i < tiles; i++) { locOut = locOut.Offset(relPosCode); } }
public static void run_off(GameObject npc, GameObject pc) { SetGlobalFlag(288, true); var location = new locXY(484, 490); npc.RunOff(location); return; }
private void CenterViewDirectly(int tileX, int tileY) { if (!IsEditor) { _mapScrollX = 0; _mapScrollY = 0; _screenCenterTile = new locXY(tileX, tileY); } }
public static bool run_off(GameObject attachee, GameObject triggerer) { var loc = new locXY(440, 416); attachee.SetStandpoint(StandPointType.Night, 258); attachee.SetStandpoint(StandPointType.Day, 258); attachee.RunOff(loc); return(RunDefault); }
public static float DistanceTo(this GameObject obj, locXY targetTile, float offX = 0, float offY = 0) { LocAndOffsets targetLoc; targetLoc.location = targetTile; targetLoc.off_x = offX; targetLoc.off_y = offY; return(obj.DistanceToLocInFeet(targetLoc)); }
public override bool OnHeartbeat(GameObject attachee, GameObject triggerer) { if ((GetGlobalFlag(288))) { var location = new locXY(484, 490); attachee.RunOff(location); } return(RunDefault); }
public static bool run_off(GameObject attachee, GameObject triggerer) { SetGlobalVar(4, 5); SetGlobalFlag(99, false); var loc = new locXY(545, 456); attachee.RunOff(loc); attachee.SetObjectFlag(ObjectFlag.OFF); return(RunDefault); }
private GameObject FindTrapAtLocation(locXY loc) { using var objListResult = ObjList.ListTile(loc, ObjectListFilter.OLC_TRAP); if (objListResult.Count > 0) { return(objListResult[0]); } return(null); }
private GameObject FindBurningScenery(locXY loc) { using var objListResult = ObjList.ListTile(loc, ObjectListFilter.OLC_SCENERY); foreach (var scenery in objListResult) { if (GameSystems.Anim.IsRunningGoal(scenery, AnimGoalType.animate_loop_fire_dmg, out _)) { return(scenery); } } return(null); }
private static GameObject fnnc(locXY location, int name, int radius = 1) { // Find NPC near coordinate, detection radius optional foreach (var npc in ObjList.ListVicinity(location, ObjectListFilter.OLC_NPC)) { var dist = Vector2.Distance(location.ToInches2D(), npc.GetLocation().ToInches2D()); if ((npc.GetNameId() == name && dist <= radius)) { return(npc); } } return(null); }
public override bool OnHeartbeat(GameObject attachee, GameObject triggerer) { if ((GetGlobalFlag(176))) { foreach (var pc in GameSystems.Party.PartyMembers) { attachee.AIRemoveFromShitlist(pc); } var location = new locXY(560, 437); attachee.RunOff(location); } return(RunDefault); }
public static float dist_from_set(int xx, int yy, IEnumerable <locXY> loc_list) { var dist_min = 100000.0f; var loc = new locXY(xx, yy).ToInches2D(); foreach (var loc_tup in loc_list) { var dist_xy = Vector2.DistanceSquared(loc, loc_tup.ToInches2D()); if (dist_xy < dist_min) { dist_min = dist_xy; } } return(dist_min); }
public static ObjList ListTile(locXY loc, ObjectListFilter flags) { Span <bool> returnTypes = stackalloc bool[ObjectTypes.Count]; CreateTypeFilter(flags, returnTypes); var result = new ObjList(); var sectorLoc = new SectorLoc(loc); if ((flags & ObjectListFilter.OLC_STATIC) != 0 || GameSystems.MapSector.IsSectorLoaded(sectorLoc)) { using var lockedSector = new LockedMapSector(sectorLoc); Sector.GetSectorTileCoords(loc, out var tileX, out var tileY); var objects = lockedSector.GetObjectsAt(tileX, tileY); result.EnsureCapacity(objects.Count); foreach (var obj in objects) { if (!GameSystems.MapObject.IsHiddenByFlags(obj) && returnTypes[(int)obj.type]) { result.Add(obj); } } } else { foreach (var obj in GameSystems.Object.SpatialIndex.EnumerateInSector(sectorLoc)) { if (!obj.type.IsStatic()) { if (!obj.HasFlag(ObjectFlag.INVENTORY) && obj.GetLocation() == loc && !GameSystems.MapObject.IsHiddenByFlags(obj) && returnTypes[(int)obj.type]) { result.Add(obj); } } } } ++dword_10808CF8; return(result); }
public static bool transform_into_demon_form(GameObject zuggtmoy, GameObject pc, int line) { if ((!GetGlobalFlag(193))) { SetGlobalFlag(193, true); StoryState = 6; var loc = zuggtmoy.GetLocation(); zuggtmoy.Destroy(); loc = new locXY(536, 499); var new_zuggtmoy = GameSystems.MapObject.CreateObject(14265, loc); if ((new_zuggtmoy != null)) { if ((GetGlobalFlag(359))) { if ((new_zuggtmoy.GetStat(Stat.hp_max) > 111)) { new_zuggtmoy.SetInt(obj_f.hp_damage, 0); new_zuggtmoy.SetBaseStat(Stat.hp_max, 111); } } new_zuggtmoy.Rotation = 3.9269908f; new_zuggtmoy.SetConcealed(true); new_zuggtmoy.Unconceal(); AttachParticles("mon-zug-appear", new_zuggtmoy); if ((line != -1)) { pc.BeginDialog(new_zuggtmoy, line); } else { new_zuggtmoy.Attack(SelectedPartyLeader); } } } return(RunDefault); }
public bool TriggerTileScript(locXY tileLoc, GameObject obj) { if (GetTileScript(tileLoc, out var tileScript)) { var invocation = new ObjScriptInvocation(); invocation.script = tileScript.Script; invocation.triggerer = obj; invocation.eventId = ObjScriptEvent.Use; GameSystems.Script.Invoke(ref invocation); if (invocation.script != tileScript.Script) { SetTileScript(in tileScript); } return(true); } return(false); }
public static bool run_off(GameObject npc, GameObject pc) { SetGlobalFlag(288, true); var location = new locXY(484, 490); npc.RunOff(location); Co8.Timed_Destroy(npc, 5000); // game.timevent_add( give_reward, (), 1209600000 ) // game.timevent_add( give_reward, (), 720000 ) QueueRandomEncounter(3605); foreach (var obj in ObjList.ListVicinity(npc.GetLocation(), ObjectListFilter.OLC_NPC)) { if ((obj.GetNameId() == 14079 || obj.GetNameId() == 14080 || obj.GetNameId() == 14067 || obj.GetNameId() == 14078)) { obj.RunOff(location); Co8.Timed_Destroy(obj, 5000); } } return(RunDefault); }
public static bool run_off(GameObject attachee, GameObject triggerer) { var lfa = new locXY(501, 490); attachee.FadeTo(0, 1, 15); // attachee.condition_add_with_args( "prone", 0, 0 ) // attachee.critter_flag_set(OCF_SLEEPING) // attachee.critter_flag_set(OCF_BLINDED) // prevent her from taking AoO attachee.SetBaseStat(Stat.strength, -5); attachee.AddCondition("Paralyzed - ability score", 0, 2, 0); StartTimer(1600, () => set_to_of_off(attachee), true); StartTimer(3500, () => set_to_of_off(attachee), true); // call it a 2nd time because it takes time for striking/casting on her to register if (!ScriptDaemon.tpsts("dala_buggered_off", 0)) { attachee.FloatLine(220, triggerer); } // attachee.runoff(lfa) // attachee.scripts[19] = 109 return(RunDefault); }
public void UpdateCenter(LocAndOffsets center) { CenterTile = center.location; _centerSubtile.X = SubtileFromOffset(center.off_x); _centerSubtile.Y = SubtileFromOffset(center.off_y); var partyMemberX = center.location.locx; var partyMemberY = center.location.locy; var radiusTiles = Radius / 3; OriginTile = new locXY(partyMemberX - radiusTiles, partyMemberY - radiusTiles); var tileRect = new TileRect { x1 = OriginTile.locx, y1 = OriginTile.locy, x2 = OriginTile.locx + Dimension / 3 - 1, y2 = OriginTile.locy + Dimension / 3 - 1 }; TileRect = tileRect; }
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 void AfterTeleportStuff(locXY loc) { Stub.TODO(); }
public static bool san_enter_combat_backup_with_beacon_shit(GameObject attachee, GameObject triggerer) { Livonya.tag_strategy(attachee); if (attachee.GetNameId() == 14811) // The Beacon { attachee.SetScriptId(ObjScriptEvent.EndCombat, 446); // end combat round script attachee.FloatMesFileLine("mes/script_activated.mes", 13, TextFloaterColor.Red); return(RunDefault); } if ((!ScriptDaemon.can_see_party(attachee) && ScriptDaemon.is_far_from_party(attachee, 10)) || ScriptDaemon.is_far_from_party(attachee, 40)) { if (ScriptDaemon.is_far_from_party(attachee, 70)) { var joe = Utilities.party_closest(attachee); ScriptDaemon.encroach(attachee, joe); } attachee.SetInt(obj_f.critter_strategy, 119); // Seek out low ac beacon AttachParticles("sp-Hold Person", attachee); if (ScriptDaemon.get_v("Beacon_Active") == 0) { var top_path = 0; var bottom_path = 0; foreach (var pc in GameSystems.Party.PartyMembers) { if (ScriptDaemon.within_rect_by_corners(pc, 467, 360, 467, 388) && !pc.IsUnconscious()) { top_path = top_path + 1; } if (ScriptDaemon.within_rect_by_corners(pc, 504, 355, 504, 385) && !pc.IsUnconscious()) { bottom_path = bottom_path + 1; } } int primary_beacon_x; int primary_beacon_y; int tertiary_beacon_x; int tertiary_beacon_y; if (top_path > bottom_path) { primary_beacon_x = 470; primary_beacon_y = 388; tertiary_beacon_x = 492; tertiary_beacon_y = 387; } else { primary_beacon_x = 492; primary_beacon_y = 387; tertiary_beacon_x = 470; tertiary_beacon_y = 388; } var beacon_loc = new locXY(primary_beacon_x, primary_beacon_y); var beacon3_loc = new locXY(tertiary_beacon_x, tertiary_beacon_y); var beacon = GameSystems.MapObject.CreateObject(14811, beacon_loc); beacon.Move(new locXY(470, 388), 0, 0); beacon.SetInt(obj_f.npc_ac_bonus, -50); beacon.SetBaseStat(Stat.dexterity, -70); // causes problems at end of round, or does it? // beacon.object_flag_set(OF_DONTDRAW) # this causes combat to lag at the beacon's turn beacon.SetObjectFlag(ObjectFlag.CLICK_THROUGH); beacon.AddToInitiative(); beacon.SetInitiative(-20); UiSystems.Combat.Initiative.UpdateIfNeeded(); beacon.SetScriptId(ObjScriptEvent.EndCombat, 446); // end combat round // beacon.scripts[14] = 446 # exit combat AttachParticles("sp-hold person", beacon); var beacon2 = GameSystems.MapObject.CreateObject(14811, new locXY(483, 395)); beacon2.Move(new locXY(483, 395), 0, 0); beacon2.SetInt(obj_f.npc_ac_bonus, -40); // beacon2.object_flag_set(OF_DONTDRAW) beacon2.SetObjectFlag(ObjectFlag.CLICK_THROUGH); beacon2.AddToInitiative(); beacon2.SetInitiative(-21); UiSystems.Combat.Initiative.UpdateIfNeeded(); AttachParticles("sp-hold person", beacon2); var beacon3 = GameSystems.MapObject.CreateObject(14811, beacon3_loc); beacon3.Move(beacon3_loc, 0, 0); beacon3.SetInt(obj_f.npc_ac_bonus, -30); // beacon3.object_flag_set(OF_DONTDRAW) beacon3.SetObjectFlag(ObjectFlag.CLICK_THROUGH); beacon3.AddToInitiative(); beacon3.SetInitiative(-23); UiSystems.Combat.Initiative.UpdateIfNeeded(); AttachParticles("sp-hold person", beacon3); ScriptDaemon.set_v("Beacon_Active", 3); } } else if (ScriptDaemon.is_far_from_party(attachee, 75)) { var joe = Utilities.party_closest(attachee); ScriptDaemon.encroach(attachee, joe); } else { Livonya.get_melee_strategy(attachee); } // Tried changing their standpoint midfight, didn't work. // attachee.standpoint_set(STANDPOINT_DAY, attachee.obj_get_int(obj_f_npc_pad_i_3) - 342 + 500) // attachee.standpoint_set(STANDPOINT_NIGHT, attachee.obj_get_int(obj_f_npc_pad_i_3) - 342 + 500) // if attachee.obj_get_int(obj_f_npc_pad_i_3) == 361 or attachee.obj_get_int(obj_f_npc_pad_i_3) == 362: #sentry standpoints // hl(attachee) // xx = 482 // yy = 417 // for npc in game.obj_list_vicinity(location_from_axis(xx,yy), OLC_NPC ): // if npc.leader_get() == OBJ_HANDLE_NULL: // npc.standpoint_set(STANDPOINT_DAY, npc.obj_get_int(obj_f_npc_pad_i_3) - 342 + 500) // npc.standpoint_set(STANDPOINT_NIGHT, npc.obj_get_int(obj_f_npc_pad_i_3) - 342 + 500) // npc.npc_flag_set(ONF_KOS) // npc.npc_flag_unset(ONF_KOS_OVERRIDE) return(RunDefault); }