Пример #1
0
        public static void MountHorse(CLRScriptBase script, uint Character, uint Horse)
        {
            if (!isWarhorse.ContainsKey(Character)) isWarhorse.Add(Character, true);

            string cloakResRef;
            switch(script.GetTag(Horse))
            {
                case "abr_cr_an_horse01":
                    cloakResRef = "acr_ooc_horse01";
                    isWarhorse[Character] = true;
                    break;
                case "abr_cr_an_horse02":
                    cloakResRef = "acr_ooc_horse02";
                    isWarhorse[Character] = true;
                    break;
                case "abr_cr_an_horse03":
                    cloakResRef = "acr_ooc_horse03";
                    isWarhorse[Character] = true;
                    break;
                default:
                    cloakResRef = "acr_ooc_horse03";
                    isWarhorse[Character] = true;
                    break;
            }
            
            uint horseCloak = script.CreateItemOnObject(cloakResRef, Character, 1, "", CLRScriptBase.FALSE);
            if (script.GetLocalInt(Horse, ACR_IS_WARHORSE) == 1)
            {
                script.RemoveHenchman(Character, Horse);
                script.SetLocalInt(horseCloak, ACR_IS_WARHORSE, 1);
            }
            script.SetLocalInt(horseCloak, ACR_HORSE_ID, script.GetLocalInt(Horse, ACR_HORSE_ID));
            script.SetLocalInt(horseCloak, ACR_HORSE_HP, script.GetCurrentHitPoints(Horse));

            uint equippedCloak = script.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_CLOAK, Character);
            
            if (script.GetIsObjectValid(equippedCloak) == CLRScriptBase.TRUE)
            {
                foreach (NWItemProperty prop in script.GetItemPropertiesOnItem(equippedCloak))
                {
                    // copying property duration type prevents us from turning temporary properties into
                    // permanent ones. But because we don't know how long the non-permanent ones have left,
                    // we pretty much have to assign them with the expectation that they immediately expire.
                    script.AddItemProperty(script.GetItemPropertyDurationType(prop), prop, horseCloak, 0.0f);
                }
                script.SetFirstName(horseCloak, script.GetName(equippedCloak) + "(( Horse Appearance ))");
                script.AddItemProperty(CLRScriptBase.DURATION_TYPE_PERMANENT, script.ItemPropertyWeightReduction(CLRScriptBase.IP_CONST_REDUCEDWEIGHT_80_PERCENT), horseCloak, 0.0f);
            }
            script.SetPlotFlag(horseCloak, CLRScriptBase.TRUE);
            script.SetPlotFlag(Horse, CLRScriptBase.FALSE);
            
            script.AssignCommand(Horse, delegate { script.SetIsDestroyable(CLRScriptBase.TRUE, CLRScriptBase.FALSE, CLRScriptBase.FALSE); });
            script.AssignCommand(Horse, delegate { script.DestroyObject(Horse, 0.0f, CLRScriptBase.FALSE); });
            script.AssignCommand(Character, delegate { script.ActionEquipItem(horseCloak, CLRScriptBase.INVENTORY_SLOT_CLOAK); });

            if (!isWarhorse[Character]) script.DelayCommand(6.0f, delegate { RidingHeartbeat(script, Character); });
        }
Пример #2
0
 private uint getHide( CLRScriptBase script )
 {
     uint oHide = script.GetItemPossessedBy(m_oCreature, "acr_pchide");
     if (script.GetIsObjectValid(oHide) == CLRScriptBase.FALSE)
     {
         oHide = script.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_CARMOUR, m_oCreature);
         if (script.GetIsObjectValid(oHide) == CLRScriptBase.FALSE || script.GetResRef(oHide) != "acr_pchide")
         {
             oHide = CLRScriptBase.OBJECT_INVALID;
         }
     }
     return oHide;
 }
        public static int GetTotalValueOfKit(CLRScriptBase script, uint Character)
        {
            int lootValue = 0;
            foreach (uint item in script.GetItemsInInventory(Character))
            {
                lootValue += script.GetGoldPieceValue(item);
            }
            lootValue += script.GetGold(Character);

            for (int slot = 0; slot < 14; slot++)
            {
                uint equip = script.GetItemInSlot(slot, Character);
                if (script.GetIsObjectValid(equip) == CLRScriptBase.TRUE)
                {
                    lootValue += script.GetGoldPieceValue(equip);
                }
            }

            if (pChestAccess.ContainsKey(Character))
            {
                foreach (string chest in pChestAccess[Character])
                {
                    lootValue += pChestValues[chest];
                }
            }
            return lootValue;
        }
        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;
            }
        }
Пример #5
0
        public static void ActivateLongTermBuffs(uint oCaster, CLRScriptBase s)
        {

            // Cast protection from good/evil based on alignment.
            if (s.GetAlignmentGoodEvil(oCaster) == CLRScriptBase.ALIGNMENT_EVIL)
            {
                _QuickBuff(oCaster, CLRScriptBase.SPELL_PROTECTION_FROM_GOOD, s);
            }
            else
            {
                _QuickBuff(oCaster, CLRScriptBase.SPELL_PROTECTION_FROM_EVIL, s);
            }

            // Buff armor, if the creature has any.
            uint oItem = s.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_CHEST, s.OBJECT_SELF);
            if (oItem != CLRScriptBase.OBJECT_INVALID)
            {
                _QuickBuff(oCaster, CLRScriptBase.SPELL_MAGIC_VESTMENT, s, oItem);
            }

            // Buff the shield, if the creature has one.
            uint oLeftHandItem = s.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_LEFTHAND, oCaster);
            uint oRightHandItem = s.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_RIGHTHAND, oCaster);
            int nLeftItemType = s.GetBaseItemType(oLeftHandItem);
            int nRightItemType = s.GetBaseItemType(oRightHandItem);
            if (GetIsItemShield(oLeftHandItem, s) != CLRScriptBase.FALSE)
            {
                _QuickBuff(oCaster, CLRScriptBase.SPELL_MAGIC_VESTMENT, s, oLeftHandItem);
            }

            // FIX ME!! Weapon-buffing should be more intelligent. But we need to be
            // able to tell what a weapon is.
            _QuickBuff(oCaster, CLRScriptBase.SPELL_KEEN_EDGE, s);
            if (s.GetHasSpell(CLRScriptBase.SPELL_GREATER_MAGIC_WEAPON, oCaster) != CLRScriptBase.FALSE)
                _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_MAGIC_WEAPON, s);
            else _QuickBuff(oCaster, CLRScriptBase.SPELL_MAGIC_WEAPON, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_WEAPON_OF_IMPACT, s);

            _QuickBuff(oCaster, CLRScriptBase.SPELL_BARKSKIN, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_SPIDERSKIN, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_CONVICTION, s);

            if (s.GetHasSpell(CLRScriptBase.SPELL_PROTECTION_FROM_ENERGY, oCaster) != CLRScriptBase.FALSE)
                _QuickBuff(oCaster, CLRScriptBase.SPELL_PROTECTION_FROM_ENERGY, s);
            else _QuickBuff(oCaster, CLRScriptBase.SPELL_ENDURE_ELEMENTS, s);

            _QuickBuff(oCaster, CLRScriptBase.SPELL_FREEDOM_OF_MOVEMENT, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_HEROISM, s);

            if (s.GetHasSpell(CLRScriptBase.SPELL_IMPROVED_MAGE_ARMOR, oCaster) != CLRScriptBase.FALSE)
                _QuickBuff(oCaster, CLRScriptBase.SPELL_IMPROVED_MAGE_ARMOR, s);
            else _QuickBuff(oCaster, CLRScriptBase.SPELL_MAGE_ARMOR, s);

            if (s.GetHasSpell(CLRScriptBase.SPELL_GREATER_PLANAR_BINDING, oCaster) != CLRScriptBase.FALSE)
                _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_PLANAR_BINDING, s);
            else if (s.GetHasSpell(CLRScriptBase.SPELL_PLANAR_BINDING, oCaster) != CLRScriptBase.FALSE)
                _QuickBuff(oCaster, CLRScriptBase.SPELL_PLANAR_BINDING, s);
            else if (s.GetHasSpell(CLRScriptBase.SPELL_PLANAR_ALLY, oCaster) != CLRScriptBase.FALSE)
                _QuickBuff(oCaster, CLRScriptBase.SPELL_PLANAR_ALLY, s);
            else _QuickBuff(oCaster, CLRScriptBase.SPELL_LESSER_PLANAR_BINDING, s);

            _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_RESISTANCE, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_MIND_BLANK, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_ONE_WITH_THE_LAND, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_PREMONITION, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_PROTECTION_FROM_SPELLS, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_PROTECTION_FROM_ARROWS, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_BULLS_STRENGTH, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_CATS_GRACE, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_EAGLE_SPLENDOR, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_BEARS_ENDURANCE, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_FOXS_CUNNING, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_OWLS_WISDOM, s);
            _QuickBuff(oCaster, CLRScriptBase.SPELL_SEE_INVISIBILITY, s);

            if (s.GetHasSpell(CLRScriptBase.SPELL_PREMONITION, oCaster) != CLRScriptBase.FALSE)
                _QuickBuff(oCaster, CLRScriptBase.SPELL_PREMONITION, s);
            else if (s.GetHasSpell(CLRScriptBase.SPELL_GREATER_STONESKIN, oCaster) != CLRScriptBase.FALSE)
                _QuickBuff(oCaster, CLRScriptBase.SPELL_GREATER_STONESKIN, s);
            else _QuickBuff(oCaster, CLRScriptBase.SPELL_STONESKIN, s);

            // Delay party buffs a bit in case this guy has buddies spawning in next to him.
            s.DelayCommand(6.0f, delegate { _QuickBuff(oCaster, CLRScriptBase.SPELL_MASS_CAMOFLAGE, s); });
        }
Пример #6
0
 private static void ProcessWaterEffects(CLRScriptBase script, uint Creature, uint Trigger)
 {
     if(script.GetIsImmune(Creature, CLRScriptBase.IMMUNITY_TYPE_MOVEMENT_SPEED_DECREASE, Trigger) != CLRScriptBase.FALSE)
     {
         return;
     }
     uint weapon = script.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_RIGHTHAND, Creature);
     if (script.GetIsObjectValid(weapon) == CLRScriptBase.TRUE)
     {
         int weaponType = script.GetBaseItemType(weapon);
         if (ALFA.Shared.Modules.InfoStore.BaseItems[weaponType].WeaponType != 1 &&
             ALFA.Shared.Modules.InfoStore.BaseItems[weaponType].WeaponType != 0) // unfortunately, this is magic numbered in the 2da as well
         {
             script.ApplyEffectToObject(CLRScriptBase.DURATION_TYPE_TEMPORARY, script.ExtraordinaryEffect(script.EffectAttackDecrease(2, CLRScriptBase.ATTACK_BONUS_ONHAND)), Creature, 6.0f);
             int damagePenalty = ALFA.Shared.Modules.InfoStore.BaseItems[weaponType].DieToRoll / 4;
             damagePenalty += script.GetAbilityModifier(CLRScriptBase.ABILITY_STRENGTH, Creature) / 2;
             int damageType = CLRScriptBase.DAMAGE_TYPE_SLASHING;
             switch (ALFA.Shared.Modules.InfoStore.BaseItems[weaponType].WeaponType)
             {
                 case 2: damageType = CLRScriptBase.DAMAGE_TYPE_BLUDGEONING; break;
                 case 3: damageType = CLRScriptBase.DAMAGE_TYPE_SLASHING; break;
                 case 4: damageType = CLRScriptBase.DAMAGE_TYPE_SLASHING; break;
                 case 5: damageType = CLRScriptBase.DAMAGE_TYPE_BLUDGEONING; break;
             }
             script.EffectDamageDecrease(damagePenalty, damageType);
         }
         weapon = script.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_LEFTHAND, Creature);
         if (script.GetIsObjectValid(weapon) == CLRScriptBase.TRUE)
         {
             weaponType = script.GetBaseItemType(weapon);
             if (ALFA.Shared.Modules.InfoStore.BaseItems[weaponType].WeaponType != 1 &&
                 ALFA.Shared.Modules.InfoStore.BaseItems[weaponType].WeaponType != 0) // unfortunately, this is magic numbered in the 2da as well
             {
                 script.ApplyEffectToObject(CLRScriptBase.DURATION_TYPE_TEMPORARY, script.ExtraordinaryEffect(script.EffectAttackDecrease(2, CLRScriptBase.ATTACK_BONUS_OFFHAND)), Creature, 6.0f);
             }
         }
     }
     else
     {
         script.ApplyEffectToObject(CLRScriptBase.DURATION_TYPE_TEMPORARY, script.ExtraordinaryEffect(script.EffectAttackDecrease(2, CLRScriptBase.ATTACK_BONUS_ONHAND)), Creature, 6.0f);
         int damagePenalty = 1 + script.GetAbilityModifier(CLRScriptBase.ABILITY_STRENGTH, Creature) / 2;
         if(damagePenalty > 0)
         {
             script.EffectDamageDecrease(damagePenalty, CLRScriptBase.DAMAGE_TYPE_BLUDGEONING);
         }
     }
 }