private static bool IsTrapDetectedBy(CLRScriptBase s, ALFA.Shared.ActiveTrap trap, uint detector) { if (trap.Detected) { return false; } if(!IsInArea(s, trap, detector)) { return false; } if (s.GetDetectMode(detector) == FALSE) { s.DelayCommand(6.0f, delegate { DetectHeartBeat(s, trap, detector); }); return false; } if (trap.DetectDC > 20 && s.GetLevelByClass(CLASS_TYPE_ROGUE, detector) == FALSE && s.GetHasSpellEffect(SPELL_FIND_TRAPS, detector) == FALSE) { s.DelayCommand(6.0f, delegate { DetectHeartBeat(s, trap, detector); }); return false; } int searchBonus = s.GetSkillRank(SKILL_SEARCH, detector, FALSE); int roll = s.d20(1); int finalDice = roll + searchBonus; if (trap.DetectDC <= finalDice) { return true; } s.DelayCommand(6.0f, delegate { DetectHeartBeat(s, trap, detector); }); return false; }
public static void RecalculateMovement(CLRScriptBase script, uint Creature) { int appType = GetBaseAppearance(script, Creature); if (appType < 0) { return; } if(overlandMap[Creature]) { if(characterMovement[Creature] == MovementType.Riding) { appType += Ride_02; script.SetCreatureAppearanceType(Creature, appType); return; } else { appType += Walk_01; script.SetCreatureAppearanceType(Creature, appType); return; } } else if(characterMovement[Creature] == MovementType.Riding) { appType += Ride_12; script.SetCreatureAppearanceType(Creature, appType); return; } else if (characterMovement[Creature] == MovementType.Swimming) { appType += Swim; script.SetCreatureAppearanceType(Creature, appType); return; } else { int moveRate = 10; if (script.GetLevelByClass(CLRScriptBase.CLASS_TYPE_BARBARIAN, Creature) >= 1) { // Barbarians get +0.4m/s when not wearing heavy armor and not carrying a heavy load. if (script.GetEncumbranceState(Creature) != CLRScriptBase.ENCUMBRANCE_STATE_OVERLOADED && script.GetArmorRank(script.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_CHEST, Creature)) != CLRScriptBase.ARMOR_RANK_HEAVY) { moveRate += 1; } } if(script.GetLevelByClass(CLRScriptBase.CLASS_TYPE_MONK, Creature) >= 3) { // Unarmored monks get +0.4m/s of movement for every 3 levels, up to level 18. if(script.GetEncumbranceState(Creature) != CLRScriptBase.ENCUMBRANCE_STATE_HEAVY && script.GetEncumbranceState(Creature) != CLRScriptBase.ENCUMBRANCE_STATE_OVERLOADED && script.GetArmorRank(script.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_CHEST, Creature)) == CLRScriptBase.ARMOR_RANK_NONE) { if (script.GetLevelByClass(CLRScriptBase.CLASS_TYPE_MONK, Creature) >= 18) moveRate++; if (script.GetLevelByClass(CLRScriptBase.CLASS_TYPE_MONK, Creature) >= 15) moveRate++; if (script.GetLevelByClass(CLRScriptBase.CLASS_TYPE_MONK, Creature) >= 12) moveRate++; if (script.GetLevelByClass(CLRScriptBase.CLASS_TYPE_MONK, Creature) >= 9) moveRate++; if (script.GetLevelByClass(CLRScriptBase.CLASS_TYPE_MONK, Creature) >= 6) moveRate++; moveRate++; } } if(script.GetHasFeat(CLRScriptBase.FEAT_NW9_FRANTIC_REACTIONS, Creature, CLRScriptBase.TRUE) == CLRScriptBase.TRUE) { // Level 3+ knight protectors have frantic reactions, and thus +0.4m/s moveRate++; } switch (moveRate) { case 10: appType += Walk_10; break; case 11: appType += Walk_11; break; case 12: appType += Walk_12; break; case 13: appType += Walk_13; break; case 14: appType += Walk_14; break; case 15: appType += Walk_15; break; case 16: appType += Walk_16; break; case 17: appType += Walk_17; break; case 18: appType += Walk_18; break; case 19: appType += Walk_19; break; case 20: appType += Walk_20; break; case 21: appType += Walk_21; break; case 22: appType += Walk_22; break; } if(script.GetHasFeat(CLRScriptBase.FEAT_MONK_ENDURANCE, Creature, CLRScriptBase.TRUE) == CLRScriptBase.TRUE) { script.FeatRemove(Creature, CLRScriptBase.FEAT_MONK_ENDURANCE); script.FeatAdd(Creature, 3742, CLRScriptBase.FALSE, CLRScriptBase.FALSE, CLRScriptBase.FALSE); } if(script.GetHasFeat(CLRScriptBase.FEAT_BARBARIAN_ENDURANCE, Creature, CLRScriptBase.TRUE) == CLRScriptBase.TRUE) { script.FeatRemove(Creature, CLRScriptBase.FEAT_BARBARIAN_ENDURANCE); script.FeatAdd(Creature, 3743, CLRScriptBase.FALSE, CLRScriptBase.FALSE, CLRScriptBase.FALSE); } script.SetCreatureAppearanceType(Creature, appType); return; } }
public static void Dismount(CLRScriptBase script, uint Character, uint Cloak, NWLocation Location) { string resRef = ""; if (script.GetLocalInt(Cloak, ACR_IS_WARHORSE) == 1) { resRef = "abr_cr_an_horse_pal_"; int nPalLevel = script.GetLevelByClass(CLRScriptBase.CLASS_TYPE_PALADIN, Character); if (nPalLevel >= 15) resRef += "15"; else if (nPalLevel >= 11) resRef += "11"; else if (nPalLevel >= 8) resRef += "8"; else if (nPalLevel >= 5) resRef += "5"; else resRef = "abr_cr_an_horse03"; } else { switch (script.GetTag(Cloak)) { case "acr_ooc_horse01": resRef = "abr_cr_an_horse01"; break; case "acr_ooc_horse02": resRef = "abr_cr_an_horse02"; break; case "acr_ooc_horse03": resRef = "abr_cr_an_horse03"; break; default: // Looks like we're not actually dismounting a horse. return; } } uint Horse = script.CreateObject(CLRScriptBase.OBJECT_TYPE_CREATURE, resRef, Location, CLRScriptBase.FALSE, ""); script.SetLocalInt(Horse, ACR_HORSE_OWNER, script.GetLocalInt(Character, ACR_CID)); script.SetLocalInt(Horse, ACR_HORSE_ID, script.GetLocalInt(Cloak, ACR_HORSE_ID)); int damage = script.GetCurrentHitPoints(Horse) - script.GetLocalInt(Cloak, ACR_HORSE_HP); if(damage > 0) { script.ApplyEffectToObject(CLRScriptBase.DURATION_TYPE_INSTANT, script.EffectDamage(damage, CLRScriptBase.DAMAGE_TYPE_MAGICAL, CLRScriptBase.DAMAGE_POWER_PLUS_TWENTY, CLRScriptBase.TRUE), Horse, 0.0f); } if (script.GetLocalInt(Cloak, ACR_IS_WARHORSE) == 1) { script.AddHenchman(Character, Horse); script.SetLocalInt(Horse, ACR_IS_WARHORSE, 1); script.SetLocalObject(Character, ACR_PAL_WARHORSE, Horse); } uint Item = GetOwnershipItemById(script, Character, script.GetLocalInt(Cloak, ACR_HORSE_ID)); script.SetLocalObject(Item , ACR_HORSE_OBJECT, Horse); script.SetLocalObject(Horse, ACR_HORSE_OBJECT, Character); script.SetLocalString(Item, ACR_HORSE_PERS_LOC_AREA, script.GetTag(script.GetArea(Horse))); script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_X, script.GetPosition(Horse).x); script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_Y, script.GetPosition(Horse).y); script.SetLocalFloat(Item, ACR_HORSE_PERS_LOC_Z, script.GetPosition(Horse).z); script.SetPlotFlag(Cloak, CLRScriptBase.FALSE); script.DestroyObject(Cloak, 0.0f, CLRScriptBase.FALSE); isWarhorse.Remove(Character); }