public int Effects_HandleApplyEffectFeignDeath(xEffect eEffect)
     {
          Log_Trace(EngineConstants.LOG_CHANNEL_EFFECTS, "Checking Feign Death");

          // -------------------------------------------------------------------------
          // Stealth and Feign Death don't like each other.
          // -------------------------------------------------------------------------
          if (GetStealthEnabled(gameObject) != EngineConstants.FALSE)
          {
               return EngineConstants.FALSE;
          }

          int nCount = GetArraySize(GetEffects(gameObject, EngineConstants.EFFECT_TYPE_FEIGN_DEATH));
          Log_Trace(EngineConstants.LOG_CHANNEL_EFFECTS, "Feign Death Count = " + ToString(nCount));

          if (nCount > 0)//!= 1)
          {

               return EngineConstants.FALSE;
          }
          else
          {

               SetStealthEnabled(gameObject, EngineConstants.TRUE);
          }
          return EngineConstants.TRUE;
     }
     // -----------------------------------------------------------------------------
     // This utility function handles the application of the xEffect and
     // should never be called directly except in Effects_h
     // -----------------------------------------------------------------------------
     public int Effects_HandleApplyEffectModifyManaStamina(xEffect eEffect)
     {
          float fAmount = GetEffectFloatRef(ref eEffect, 0);
          GameObject oTarget = gameObject;

          return Effect_InstantApplyEffectModifyManaStamina(oTarget, fAmount);
     }
Example #3
0
        public int ImportTimingGrid(TimingGrid beatGrid, xTimings xEffects)
        {
            int errs      = 0;
            int lastStart = -1;

            // If grid already has timings (from a previous run) clear them, start over fresh
            if (beatGrid.timings.Count > 0)
            {
                beatGrid.timings.Clear();
            }
            beatGrid.TimingGridType = TimingGridType.Freeform;
            for (int q = 0; q < xEffects.effects.Count; q++)
            {
                xEffect xef = xEffects.effects[q];
                int     t   = ms2cs(xef.starttime);
                if (t > lastStart)
                {
                    if (t < Sequence.Centiseconds)
                    {
                        beatGrid.AddTiming(t);
                    }
                }
                lastStart = t;
            }
            return(errs);
        }
     public int Effects_HandleRemoveEffectRecurringKnockdown(xEffect eEffect)
     {
          // check to see if the xEffect should be removed
          // if not, delay apply again

          return 1;
     }
Example #5
0
     public void _ApplyInjuryEffect(GameObject oCharacter, xEffect eEffect, int nInjury)
     {

          ApplyEffectOnObject(EngineConstants.EFFECT_DURATION_TYPE_PERMANENT, eEffect, oCharacter, 0.0f, oCharacter, EngineConstants.INJURY_ABILITY_EFFECT_ID + nInjury);
          // Handle injury stats
          STATS_HandleInjuries(oCharacter);
     }
Example #6
0
     public int Effects_HandleApplyEffectStealth(xEffect eEffect)
     {

          // -------------------------------------------------------------------------
          // Safety for Stealth flag
          // -------------------------------------------------------------------------
          /* if (GetStealthEnabled(gameObject))
           {
               return EngineConstants.FALSE;
           }*/

          xEffect eTransparent = Effect(EngineConstants.EFFECT_TYPE_ALPHA);
          float fPotency = 0.0f;

          // -------------------------------------------------------------------------
          // Party members only become partially invisible
          // -------------------------------------------------------------------------
          if (IsPartyMember(gameObject) != EngineConstants.FALSE)
          {
               fPotency = 0.5f;
          }
          else
          {
               // --------------------------------------------------------------------
               // Non party members are not interactive anymore
               // --------------------------------------------------------------------
               SetObjectInteractive(gameObject, EngineConstants.FALSE);
          }

          SetEffectEngineFloatRef(ref eTransparent, EngineConstants.EFFECT_FLOAT_POTENCY, fPotency);
          Engine_ApplyEffectOnObject(EngineConstants.EFFECT_DURATION_TYPE_PERMANENT, eTransparent, gameObject, 0.0f, gameObject, GetEffectAbilityIDRef(ref eEffect));
          SetStealthEnabled(gameObject, EngineConstants.TRUE);

          return EngineConstants.TRUE;
     }
Example #7
0
     // -----------------------------------------------------------------------------
     // sys_injury
     // -----------------------------------------------------------------------------
     /*
         Injury System

         The injury system uses special, permanently applied xEffects to a party member
         to mimic last damage sustained when dropping in combat.

         Note about injury xEffects:

         -   these are normal xEffects, however they are applied with an id of
             50000 (EngineConstants.INJURY_SPELL_ID) + injury index


     */
     // -----------------------------------------------------------------------------
     // owner: georg zoeller
     // -----------------------------------------------------------------------------

     //#include "log_h"
     //#include "core_h"
     //#include "wrappers_h"
     //#include "2da_constants_h"

     //#include "plt_tut_combat_injury"
     //#include "plt_tut_combat_injury_lots"

     //#include "stats_core_h"

     //moved const int TUTORIAL_LOTS_OF_INJURIES_THRESHOLD = 5;
     public xEffect _CreateInjuryEffect(int nInjuryIndex)
     {

          // -------------------------------------------------------------------------


          int nEffect = GetM2DAInt(EngineConstants.TABLE_RULES_INJURIES, "effect", nInjuryIndex);
          Log_Trace(EngineConstants.LOG_CHANNEL_CHARACTER, "injury.CreateInjuryEffect", "Effect for index " + ToString(nInjuryIndex) + " = " + ToString(nEffect));
          int nIntParam1 = GetM2DAInt(EngineConstants.TABLE_RULES_INJURIES, "effect_int1", nInjuryIndex);
          int nIntParam2 = GetM2DAInt(EngineConstants.TABLE_RULES_INJURIES, "effect_int2", nInjuryIndex);


          float fFloatParam1 = GetM2DAFloat(EngineConstants.TABLE_RULES_INJURIES, "effect_float1", nInjuryIndex);
          float fFloatParam2 = GetM2DAFloat(EngineConstants.TABLE_RULES_INJURIES, "effect_float2", nInjuryIndex);


          xEffect e = new xEffect(EngineConstants.EFFECT_TYPE_INVALID);
          if (nEffect > 0)
          {
               e = Effect(nEffect);

               SetEffectIntegerRef(ref e, 0, nIntParam1);
               SetEffectIntegerRef(ref e, 1, nIntParam2);

               SetEffectFloatRef(ref e, 0, fFloatParam1);
               SetEffectFloatRef(ref e, 1, fFloatParam2);

          }

          return e;
     }
Example #8
0
     // -----------------------------------------------------------------------------
     // This utility function handles the application of the xEffect and
     // should never be called directly except in Effects_h
     // -----------------------------------------------------------------------------
     public int Effects_HandleApplyEffectSummon(xEffect eEffect)
     {

          GameObject oOwner = GetEffectObjectRef(ref eEffect, 0);
          GameObject oCreature = GetEffectObjectRef(ref eEffect, 1);

          if ((gameObject == oOwner || gameObject == oCreature) && IsObjectValid(oCreature) != EngineConstants.FALSE)
          {
               //     ApplyEffectVisualEffect(oCreature, oCreature, 1070,EngineConstants.EFFECT_DURATION_TYPE_INSTANT, 0.0f, GetEffectAbilityIDRef(ref eEffect));

               if (gameObject == oCreature)
               {
                    SetLocalInt(oCreature, EngineConstants.IS_SUMMONED_CREATURE, EngineConstants.TRUE);
                    SetGroupId(oCreature, GetGroupId(oOwner));

                    xEvent eActivate = Event(EngineConstants.EVENT_TYPE_SET_OBJECT_ACTIVE);
                    SetEventIntegerRef(ref eActivate, 0, EngineConstants.TRUE);

                    if (IsPartyMember(oOwner) != EngineConstants.FALSE)
                    {
                         // the follower state is now ignored for this xEvent - it has moved to ability_summon_h
                         SetEventIntegerRef(ref eActivate, 1, EngineConstants.FOLLOWER_STATE_ACTIVE);
                    }

                    DelayEvent(0.5f, oCreature, eActivate);
               }

               return EngineConstants.TRUE;
          }
          else
          {
               return EngineConstants.FALSE;
          }

     }
Example #9
0
     public int Effects_HandleRemoveEffectStealth(xEffect eEffect)
     {

          SetStealthEnabled(gameObject, EngineConstants.FALSE);

          List<xEffect> aTransparent = GetEffects(gameObject, EngineConstants.EFFECT_TYPE_ALPHA, GetEffectAbilityIDRef(ref eEffect), gameObject, EngineConstants.EFFECT_DURATION_TYPE_PERMANENT);
          int nSize = GetArraySize(aTransparent);
          int i;

          for (i = 0; i < nSize; i++)
          {
               RemoveEffect(gameObject, aTransparent[i]);
          }

          if (IsPartyMember(gameObject) == EngineConstants.FALSE)
          {
               //  ----------------------------------------------------------------
               //  This makes one assumption:
               //  None interactive objects are never using stealth, otherwise
               //  dropping out of stealth will modify their interactive status.
               //  ----------------------------------------------------------------
               SetObjectInteractive(gameObject, EngineConstants.TRUE);
          }

          Log_Trace(EngineConstants.LOG_CHANNEL_SYSTEMS, "effect_stealth", "Deactivating stealth flag");

          DEBUG_PrintToScreen("stealth enabled: " + ToString(GetStealthEnabled(gameObject)));

          return EngineConstants.TRUE;
     }
Example #10
0
     //==============================================================================
     // effect_disease_h
     //------------------------------------------------------------------------------
     /*

         Effect: Disease

             When applied to an object, this xEffect applies a disease to the object.
             This Disease has a sub-xEffect which will also be applied and removed
             with the disease itself.

     */
     //------------------------------------------------------------------------------
     // Created By: Joshua Stiksma
     // Created On: January 16, 2007
     //==============================================================================

     //#include"2da_constants_h"
     //#include"log_h"

     //==============================================================================
     // CONSTANTS
     //==============================================================================

     //moved public const string    EngineConstants.DISEASE_2DA_EFFECT          = "effect";
     //moved public const string    EngineConstants.DISEASE_2DA_INT0            = "effect_int1";
     //moved public const string    EngineConstants.DISEASE_2DA_INT1            = "effect_int2";
     //moved public const string    EngineConstants.DISEASE_2DA_FLOAT0          = "effect_float1";
     //moved public const string    EngineConstants.DISEASE_2DA_FLOAT1          = "effect_float2";

     //==============================================================================
     // FUNCTION DECLARATIONS
     //==============================================================================

     //==============================================================================
     // FUNCTION DEFINITIONS
     //------------------------------------------------------------------------------
     // _CreateDiseaseSubEffect
     //------------------------------------------------------------------------------

     public xEffect _CreateDiseaseSubEffect(xEffect eEffect, int nDiseaseID)
     {

          int nEffect;
          int nInt0;
          int nInt1;
          float fFloat0;
          float fFloat1;
          xEffect eSubEffect;

          //--------------------------------------------------------------------------

          nEffect = GetM2DAInt(EngineConstants.TABLE_RULES_DISEASES, EngineConstants.DISEASE_2DA_EFFECT, nDiseaseID);
          nInt0 = GetM2DAInt(EngineConstants.TABLE_RULES_DISEASES, EngineConstants.DISEASE_2DA_INT0, nDiseaseID);
          nInt1 = GetM2DAInt(EngineConstants.TABLE_RULES_DISEASES, EngineConstants.DISEASE_2DA_INT1, nDiseaseID);
          fFloat0 = GetM2DAFloat(EngineConstants.TABLE_RULES_DISEASES, EngineConstants.DISEASE_2DA_FLOAT0, nDiseaseID);
          fFloat1 = GetM2DAFloat(EngineConstants.TABLE_RULES_DISEASES, EngineConstants.DISEASE_2DA_FLOAT1, nDiseaseID);
          eSubEffect = Effect(nEffect);

        //--------------------------------------------------------------------------

        SetEffectIntegerRef(ref eSubEffect, 0, nInt0);
        SetEffectIntegerRef(ref eSubEffect, 1, nInt1);
        SetEffectIntegerRef(ref eSubEffect, 2, GetEffectIDRef(ref eEffect));
        SetEffectFloatRef(ref eSubEffect, 0, fFloat0);
        SetEffectFloatRef(ref eSubEffect, 1, fFloat1);

          return eSubEffect;

     }
Example #11
0
     ///////////////////////////////////////////////////////////////////////////////
     //  Effects_HandleRemoveEffectDaze
     ///////////////////////////////////////////////////////////////////////////////
     //  Created By: Georg Zoeller
     //  Created On: Jan 2007
     ///////////////////////////////////////////////////////////////////////////////
     public int Effects_HandleRemoveEffectDaze(xEffect eEffect)
     {
          // remove attack and defense debuff
          UpdateCreatureProperty(gameObject, EngineConstants.PROPERTY_ATTRIBUTE_ATTACK, EngineConstants.DAZE_ATTACK_PENALTY * -1.0f, EngineConstants.PROPERTY_VALUE_MODIFIER);
          UpdateCreatureProperty(gameObject, EngineConstants.PROPERTY_ATTRIBUTE_DEFENSE, EngineConstants.DAZE_DEFENSE_PENALTY * -1.0f, EngineConstants.PROPERTY_VALUE_MODIFIER);

          return EngineConstants.TRUE;
     }
Example #12
0
     ///////////////////////////////////////////////////////////////////////////////
     //  Created By: Yaron Jakobs
     //  Created On: Sep 13, 2006
     ///////////////////////////////////////////////////////////////////////////////
     public int Effects_HandleRemoveEffectKnockdown(xEffect eEffect)
     {

          // This ie being removed because of possible corruption issues.
          //UpdateCreatureProperty(gameObject,EngineConstants.PROPERTY_ATTRIBUTE_DEFENSE,25.0f,EngineConstants.PROPERTY_VALUE_MODIFIER);

          return EngineConstants.TRUE;
     }
     //==============================================================================
     /*

         A Paragon of Her Kind
          -> Caridin/Branka Include Script

     */
     //------------------------------------------------------------------------------
     // Created By: joshua
     // Created On: December 18, 2008
     //==============================================================================

     //#include"utility_h"
     //#include"events_h"
     //#include"orz_constants_h"
     //#include"cai_h"

     //------------------------------------------------------------------------------
     // Constants
     //------------------------------------------------------------------------------

     //moved public const int       EngineConstants.ORZ_ANVIL_EVENT_LAVA_QUAKE              = EngineConstants.EVENT_TYPE_CUSTOM_EVENT_01;
     //moved public const int       EngineConstants.ORZ_ANVIL_EVENT_ROCK_FALL               = EngineConstants.EVENT_TYPE_CUSTOM_EVENT_03;
     //moved public const int       EngineConstants.ORZ_ANVIL_EVENT_BRANKA_ILLUSION         = EngineConstants.EVENT_TYPE_CUSTOM_EVENT_05;
     //moved public const int       EngineConstants.ORZ_ANVIL_EVENT_ROCK_FALL_IMPACT        = EngineConstants.EVENT_TYPE_CUSTOM_EVENT_06;

     //moved public const int       EngineConstants.ORZ_ANVIL_LAVA_QUAKE_ERUPTION_VFX       = 93051;
     //moved public const int       EngineConstants.ORZ_ANVIL_LAVA_QUAKE_EARTHQUAKE_VFX     = 1052;
     //moved public const int       EngineConstants.ORZ_ANVIL_LAVA_QUAKE_DOT_CRUST_VFX      = 93056;
     //moved public const int       EngineConstants.ORZ_ANVIL_LAVA_QUAKE_DOT_IMPACT_VFX     = 1107;
     //moved public const int       EngineConstants.ORZ_ANVIL_LAVA_QUAKE_ABILITY_ID         = 90153;
     //moved public const int       EngineConstants.ORZ_ANVIL_LAVA_QUAKE_SCREENSHAKE_ID     = 2;
     //moved public const int       EngineConstants.ORZ_ANVIL_LAVA_QUAKE_MAX_ERUPTIONS      = 7;
     //moved public const int       EngineConstants.ORZ_ANVIL_LAVA_QUAKE_NUM_GROUPS         = 5; 
     //moved public const int       EngineConstants.ORZ_ANVIL_LAVA_QUAKE_AOE_ID             = 234;
     //moved public const float     EngineConstants.ORZ_ANVIL_LAVA_QUAKE_DOT_DAMAGE         = 30.0f;
     //moved public const float     EngineConstants.ORZ_ANVIL_LAVA_QUAKE_DOT_DURATION       = 10.0f;
     //moved public const float     EngineConstants.ORZ_ANVIL_LAVA_QUAKE_GROUP_DELAY        = 15.0f;
     //moved public const float     EngineConstants.ORZ_ANVIL_LAVA_QUAKE_RADIUS             = 2.0f;

     //moved public const int       EngineConstants.ORZ_ANVIL_ROCK_FALL_PROJECTILE_ID       = 207;
     //moved public const float     EngineConstants.ORZ_ANVIL_ROCK_FALL_DAMAGE              = 50.0f;
     //moved public const float     EngineConstants.ORZ_ANVIL_ROCK_FALL_GROUP_DELAY         = 5.0f;

     //moved public const int       EngineConstants.ORZ_ANVIL_ILLUSION_COPY_SPIRIT_VFX      = 1041;
     //moved public const int       EngineConstants.ORZ_ANVIL_ILLUSION_COPY_AOE_VFX         = 1057;

     //moved public const string    EngineConstants.ORZ_ANVIL_WP_LAVA_QUAKE_PREFIX          = "wp_lava_quake_g";

     //moved public const string  rORZ_ANVIL_CR_BRANKA_ILLUSION           = "orz540cr_branka_clone.utc";

     //------------------------------------------------------------------------------
     // Function Declaration
     //------------------------------------------------------------------------------
     // Event Handler Functions

     // Local stuff, these should only be called by the functions in this script

     //------------------------------------------------------------------------------
     // Function Implementation
     //------------------------------------------------------------------------------

     public void _CreateIllusionCopy(GameObject oSpirit, Vector3 loc, xEffect eff, GameObject oCreator)
     {
          RemoveAllEffects(oSpirit, EngineConstants.FALSE, EngineConstants.TRUE);
          ApplyEffectOnObject(EngineConstants.EFFECT_DURATION_TYPE_PERMANENT, eff, oSpirit, 0.0f, oCreator);
          SetLocalInt(oSpirit, EngineConstants.CREATURE_COUNTER_1, 0);
          WR_AddCommand(oSpirit, CommandJumpToLocation(loc), EngineConstants.TRUE);
          WR_SetObjectActive(oSpirit, EngineConstants.TRUE);
          CAI_SetCustomAI(oSpirit, EngineConstants.CAI_INACTIVE);
     }
     public int Effects_HandleRemoveEffectMabariDominance(xEffect eEffect)
     {
          // remove buff
          UpdateCreatureProperty(gameObject, EngineConstants.PROPERTY_ATTRIBUTE_STRENGTH, EngineConstants.MABARI_DOMINANCE_STRENGTH_BONUS * -1.0f, EngineConstants.PROPERTY_VALUE_MODIFIER);
          UpdateCreatureProperty(gameObject, EngineConstants.PROPERTY_ATTRIBUTE_CONSTITUTION, EngineConstants.MABARI_DOMINANCE_CONSTITUTION_BONUS * -1.0f, EngineConstants.PROPERTY_VALUE_MODIFIER);
          UpdateCreatureProperty(gameObject, EngineConstants.PROPERTY_ATTRIBUTE_WILLPOWER, EngineConstants.MABARI_DOMINANCE_WILLPOWER_BONUS * -1.0f, EngineConstants.PROPERTY_VALUE_MODIFIER);

          return EngineConstants.TRUE;
     }
Example #15
0
     // -----------------------------------------------------------------------------
     // This utility function handles the removal of the xEffect and
     // should never be called directly except in Effects_h
     // -----------------------------------------------------------------------------
     public int Effects_HandleRemoveEffectAddAbility(xEffect eEffect)
     {
          int nAbility = GetEffectIntegerRef(ref eEffect, 0);
          RemoveAbility(gameObject, nAbility);
          Log_Trace(EngineConstants.LOG_CHANNEL_TEMP, "AddAbility - REMOVE:", ToString(nAbility));


          return EngineConstants.TRUE;
     }
Example #16
0
     public int Effects_HandleApplyEffectRoot(xEffect eEffect)
     {
          // increment stationary counter
          int nStationaryFlag = GetLocalInt(gameObject, EngineConstants.AI_FLAG_STATIONARY);
          LogTrace(EngineConstants.LOG_CHANNEL_EFFECTS, "Stationary AI Flag = " + ToString(nStationaryFlag), gameObject);
          nStationaryFlag += 2;
          LogTrace(EngineConstants.LOG_CHANNEL_EFFECTS, "Altered Stationary AI Flag = " + ToString(nStationaryFlag), gameObject);
          SetLocalInt(gameObject, EngineConstants.AI_FLAG_STATIONARY, nStationaryFlag);

          return EngineConstants.TRUE;
     }
     public int Effects_HandleRemoveEffectFeignDeath(xEffect eEffect)
     {
          int nCount = GetArraySize(GetEffects(gameObject, EngineConstants.EFFECT_TYPE_FEIGN_DEATH));
          Log_Trace(EngineConstants.LOG_CHANNEL_EFFECTS, "Feign Death Count = " + ToString(nCount));

          if (nCount == 0)
          {
               SetStealthEnabled(gameObject, EngineConstants.FALSE);
          }

          return EngineConstants.TRUE;
     }
     public int Effects_HandleApplyEffectModifyCritChance(xEffect eEffect)
     {
          int nProperty = GetEffectIntegerRef(ref eEffect, 0);
          float fChange = GetEffectFloatRef(ref eEffect, 0);

          UpdateCreatureProperty(gameObject, nProperty, fChange, EngineConstants.PROPERTY_VALUE_MODIFIER);

          //<Debug>
          float fNew = GetCreatureProperty(gameObject, nProperty, EngineConstants.PROPERTY_VALUE_TOTAL);
          Log_Trace(EngineConstants.LOG_CHANNEL_CHARACTER_STATS, "New Critical Chance (" + IntToString(nProperty) + ") = " + FloatToString(fNew));
          // </Debug>
          return EngineConstants.TRUE;
     }
Example #19
0
     ///////////////////////////////////////////////////////////////////////////////
     //  Created By: Yaron Jakobs
     //  Created On: Sep 13, 2006
     ///////////////////////////////////////////////////////////////////////////////
     public int Effects_HandleApplyEffectKnockdown(xEffect eEffect)
     {

          if (GetArraySize(GetEffects(gameObject, EngineConstants.EFFECT_TYPE_KNOCKDOWN)) > 1)
          {
               Log_Trace(EngineConstants.LOG_CHANNEL_EFFECTS, "ApplyKnockdown", "NOT applying knockdown, target already knocked down!");
               return EngineConstants.FALSE;
          }

          // This ie being removed because of possible corruption issues.
          //UpdateCreatureProperty(gameObject,EngineConstants.PROPERTY_ATTRIBUTE_DEFENSE,-25.0f,EngineConstants.PROPERTY_VALUE_MODIFIER);

          return EngineConstants.TRUE;

     }
Example #20
0
     ///////////////////////////////////////////////////////////////////////////////
     //  Effects_HandleApplyEffectSleep
     ///////////////////////////////////////////////////////////////////////////////
     //  Created By: Georg Zoeller
     //  Created On: Jan 2007
     ///////////////////////////////////////////////////////////////////////////////
     public int Effects_HandleApplyEffectSleep(xEffect eEffect)
     {

          if (GetArraySize(GetEffects(gameObject, EngineConstants.EFFECT_TYPE_SLEEP)) > 1  /*this includes this xEffect */)
          {
               Log_Trace(EngineConstants.LOG_CHANNEL_EFFECTS, "ApplySleep", "NOT applying sleep, target already sleepling!");
               return EngineConstants.FALSE;
          }

          // Sleep debuffs dexterity. Note that we're subtracting a very large number here, but because the
          // property system confines the actual value between floor and ceiling, it will never drop below 1.
          // This is intended behavior.
          UpdateCreatureProperty(gameObject, EngineConstants.PROPERTY_ATTRIBUTE_DEXTERITY, EngineConstants._EFFECT_SLEEP_DEXTERITY_DEBUFF, EngineConstants.PROPERTY_VALUE_MODIFIER);

          return EngineConstants.TRUE;
     }
     public int Effects_HandleApplyEffectRegeneration(xEffect eEffect)
     {
          int nType = GetEffectIntegerRef(ref eEffect, 0);

          if (nType != 0)
          {
               _ReadAndApplyRegenerationEffect(nType, EngineConstants.TRUE);
          }
          else
          {
               Log_Trace_Scripting_Error("effect_regeneration_h.Apply", "Type was 0 for regeneration effect");
               return EngineConstants.FALSE;
          }

          return EngineConstants.TRUE;
     }
     public int Effects_HandleApplyEffectDispelMagic(xEffect eEffect)
     {
          int nNoSpells = GetEffectIntegerRef(ref eEffect, 0);

          // -------------------------------------------------------------------------
          // First Remove all Upkeep Effects.
          // -------------------------------------------------------------------------
          List<xEffect> arSpell = GetEffects(gameObject, EngineConstants.EFFECT_TYPE_UPKEEP);
          int nSize = GetArraySize(arSpell);
          int i;
          int nId;
          for (i = 0; i < nSize; i++)
          {
            xEffect _effect = arSpell[i];
               nId = GetEffectAbilityIDRef(ref _effect);

               // ---------------------------------------------------------------------
               // We only dispell EngineConstants.ABILITY_TYPE_SPELL!
               // ---------------------------------------------------------------------
               if (Ability_GetAbilityType(nId) == EngineConstants.ABILITY_TYPE_SPELL)
               {
                    RemoveEffect(gameObject, arSpell[i]);
               }
          }

          // -------------------------------------------------------------------------
          // Second Remove all other spell effects
          // -------------------------------------------------------------------------

          arSpell = GetEffects(gameObject);
          nSize = GetArraySize(arSpell);
          for (i = 0; i < nSize; i++)
          {
            xEffect _effect = arSpell[i];
               nId = GetEffectAbilityIDRef(ref _effect);
               // ---------------------------------------------------------------------
               // We only dispell EngineConstants.ABILITY_TYPE_SPELL!
               // ---------------------------------------------------------------------
               if (Ability_GetAbilityType(nId) == EngineConstants.ABILITY_TYPE_SPELL)
               {
                    RemoveEffect(gameObject, arSpell[i]);
               }
          }

          return EngineConstants.TRUE;

     }
Example #23
0
     public int Effects_HandleApplyEffectUpkeep(xEffect eEffect)
     {
          int nUpkeepType = GetEffectIntegerRef(ref eEffect, 0);
          int nAbilityId = GetEffectIntegerRef(ref eEffect, 1);
          float fFatigue = GetEffectFloatRef(ref eEffect, 1);

          float fAmount = GetEffectFloatRef(ref eEffect, 0);
          // -----------------------------------------------------------------
          // Do not apply this xEffect if it would bring us below 0
          // -----------------------------------------------------------------

          float fMaxStamina = GetCreatureProperty(gameObject, EngineConstants.PROPERTY_DEPLETABLE_MANA_STAMINA, EngineConstants.PROPERTY_VALUE_TOTAL);

          if (fMaxStamina + fAmount < 0.0f)
          {
               return EngineConstants.FALSE;
          }

          // -------------------------------------------------------------------------
          // This is where the upkeep amount is reserved
          // -------------------------------------------------------------------------
          UpdateCreatureProperty(gameObject, EngineConstants.PROPERTY_DEPLETABLE_MANA_STAMINA, fAmount, EngineConstants.PROPERTY_VALUE_MODIFIER);

          // -------------------------------------------------------------------------
          // This is where the fatigue cost gets applied
          // -------------------------------------------------------------------------
          if (fFatigue > 0.0f)
          {
               UpdateCreatureProperty(gameObject, EngineConstants.PROPERTY_ATTRIBUTE_FATIGUE, fFatigue, EngineConstants.PROPERTY_VALUE_MODIFIER);
          }

#if DEBUG
          Log_Trace(EngineConstants.LOG_CHANNEL_EFFECTS, "effect_upkeep_h.Effects_HandleApplyEffectUpkeep", "Upkeep xEffect applied for ability " + IntToString(nAbilityId));
#endif

          // -------------------------------------------------------------------------
          // Valid Ability ID - Synchronize Modal ability UI
          // -------------------------------------------------------------------------
          if (nAbilityId != EngineConstants.ABILITY_INVALID)
          {
               Engine_SetModalAbilityGUI(gameObject, nAbilityId, EngineConstants.TRUE);
          }

          return EngineConstants.TRUE;
     }
Example #24
0
     public int Effects_HandleRemoveEffectRoot(xEffect eEffect)
     {
          // decrement stationary counter
          int nStationaryFlag = GetLocalInt(gameObject, EngineConstants.AI_FLAG_STATIONARY);
          LogTrace(EngineConstants.LOG_CHANNEL_EFFECTS, "Stationary AI Flag = " + ToString(nStationaryFlag), gameObject);
          nStationaryFlag -= 2;

          // make sure it doesn't go below 0
          if (nStationaryFlag < 0)
          {
               nStationaryFlag = 0;
          }

          LogTrace(EngineConstants.LOG_CHANNEL_EFFECTS, "Altered Stationary AI Flag = " + ToString(nStationaryFlag), gameObject);
          SetLocalInt(gameObject, EngineConstants.AI_FLAG_STATIONARY, nStationaryFlag);

          return EngineConstants.TRUE;
     }
Example #25
0
     public int Effects_HandleRemoveEffectTest(xEffect eEffect)
     {
          // check to see if the player has the object
          GameObject oItem = GetItemPossessedBy(gameObject, "gen_im_amb_rshield_kite_a");
          if (oItem != null)
          {
               // if true, destroy and return true
               Log_Trace(EngineConstants.LOG_CHANNEL_EFFECTS, GetCurrentScriptName(), "Object Exists");
               DestroyObject(oItem, 0);

               return EngineConstants.TRUE;
          }
          else
          {
               // if false, return false
               Log_Trace(EngineConstants.LOG_CHANNEL_EFFECTS, GetCurrentScriptName(), "Object Does Not Exist");
               return EngineConstants.FALSE;
          }
     }
Example #26
0
     public int Effects_HandleApplyEffectTest(xEffect eEffect)
     {
          // check to see if the player already has an item of this name
          GameObject oItem = GetItemPossessedBy(gameObject, "gen_im_arm_shd_kit_wdn");
          if (oItem != null)
          {
               // if true, return false
               Log_Trace(EngineConstants.LOG_CHANNEL_EFFECTS, GetCurrentScriptName(), "Object Exists");
               return EngineConstants.FALSE;
          }
          else
          {
               // if false, create GameObject and return true
               Log_Trace(EngineConstants.LOG_CHANNEL_EFFECTS, GetCurrentScriptName(), "Object Does Not Exist");
               oItem = CreateItemOnObject("gen_im_arm_shd_kit_wdn.uti", gameObject);
               SetTag(oItem, "gen_im_arm_shd_kit_wdn");

               return EngineConstants.TRUE;
          }
     }
Example #27
0
     // -----------------------------------------------------------------------------
     // This utility function handles the application of the xEffect and
     // should never be called directly except in Effects_h
     // -----------------------------------------------------------------------------
     public int Effects_HandleApplyEffectAddAbility(xEffect eEffect)
     {
          int nAbility = GetEffectIntegerRef(ref eEffect, 0);
          if (nAbility > EngineConstants.ABILITY_INVALID)
          {

               Log_Trace(EngineConstants.LOG_CHANNEL_TEMP, "AddAbility:", ToString(nAbility));


               AddAbility(gameObject, nAbility);
               SetQuickslot(gameObject, 7, nAbility);
               return EngineConstants.TRUE;
          }
          else
          {
               Log_Trace(EngineConstants.LOG_CHANNEL_TEMP, "AddAbility Failed:", ToString(nAbility));
               return EngineConstants.FALSE;
          }

     }
Example #28
0
     public int Effects_HandleApplyEffectHeartbeat(xEffect eEffect)
     {

          int nSubEvent = GetEffectIntegerRef(ref eEffect, 0);
          // Force a single instance per subtype
          List<xEffect> aHbs = GetEffects(gameObject, EngineConstants.EFFECT_TYPE_HEARTBEAT, 0, GetModule());
          int nSize = GetArraySize(aHbs);
          int i;

          int nFound = 0;
          int nEffectId = 0;
          for (i = 0; i < nSize; i++)
          {
            xEffect _effect = aHbs[i];
               if (GetEffectIntegerRef(ref _effect, 0) == nSubEvent)
               {
                    nFound++;
                    // return EngineConstants.FALSE;
               }

               if (nFound > 1) /*>1 because this xEffect is technically applied already, we just unapply it on failure */
               {
                    Log_Trace(EngineConstants.LOG_CHANNEL_DESIGN_SCRIPTERROR, "effect_heartbeat", "More than one HB xEffect with id " + ToString(nSubEvent) + " found on object");
                    return EngineConstants.FALSE;
               }

          }

          nEffectId = GetEffectIDRef(ref eEffect);

          float fRate = GetEffectFloatRef(ref eEffect, 0);

          xEvent ev = Event(EngineConstants.EVENT_TYPE_HEARTBEAT);
          SetEventFloatRef(ref ev, 0, fRate);
          SetEventIntegerRef(ref ev, 0, nSubEvent);
          SetEventIntegerRef(ref ev, 1, nEffectId);

          SignalEvent(gameObject, ev);

          return EngineConstants.TRUE;
     }
     public int Effects_HandleRemoveEffectModifyAttribute(xEffect eEffect)
     {
          int nAttribute = GetEffectIntegerRef(ref eEffect, 0);
          int nAmount = GetEffectIntegerRef(ref eEffect, 1) * -1;

          if (nAttribute == EngineConstants.EFFECT_MODIFY_ATTRIBUTE_ATTRIBUTE_ALL)
          {
               _ChangeAttributeModifier(gameObject, EngineConstants.PROPERTY_ATTRIBUTE_DEXTERITY, nAmount);
               _ChangeAttributeModifier(gameObject, EngineConstants.PROPERTY_ATTRIBUTE_CONSTITUTION, nAmount);
               _ChangeAttributeModifier(gameObject, EngineConstants.PROPERTY_ATTRIBUTE_INTELLIGENCE, nAmount);
               _ChangeAttributeModifier(gameObject, EngineConstants.PROPERTY_ATTRIBUTE_WILLPOWER, nAmount);
               _ChangeAttributeModifier(gameObject, EngineConstants.PROPERTY_ATTRIBUTE_STRENGTH, nAmount);
               _ChangeAttributeModifier(gameObject, EngineConstants.PROPERTY_ATTRIBUTE_MAGIC, nAmount);
          }
          else
          {
               _ChangeAttributeModifier(gameObject, nAttribute, nAmount);

          }
          return EngineConstants.TRUE;
     }
Example #30
0
 // -----------------------------------------------------------------------------
 // This utility function handles the application of the xEffect and
 // should never be called directly except in Effects_h
 // -----------------------------------------------------------------------------
 public int Effects_HandleApplyEffectSwarm(xEffect eEffect)
 {
      return EngineConstants.TRUE;
 }
Example #31
0
        public int ImportBeatChannel(Channel beatCh, xTimings xEffects, int barDivs, int firstBeat, bool ramps)
        {
            int errs = 0;
            // Detect if we are doing 'Bars' channel for special handling
            bool bars = false;
            int  b    = beatCh.Name.IndexOf("Bars");

            if (b >= 0)
            {
                bars = true;
            }
            int halfBar = 10;

            // If channel already has effects (from a previous run) clear them, start over fresh
            if (beatCh.effects.Count > 0)
            {
                beatCh.effects.Clear();
            }
            //int lb = barDivs - 1;
            for (int q = 0; q < xEffects.effects.Count; q++)
            {
                if (ramps)
                {
                    xEffect xef = xEffects.effects[q];
                    Effect  lef = new Effect();
                    lef.EffectType       = EffectType.Intensity;
                    lef.startIntensity   = 100;
                    lef.endIntensity     = 0;
                    lef.startCentisecond = ms2cs(xef.starttime);
                    // Note: No special handling required for bars if using ramps
                    lef.endCentisecond = ms2cs(xef.endtime);
                    //if (q < (xEffects.effects.Count - 1))
                    //{
                    // Alternative
                    //	lef.endCentisecond = ms2cs(xEffects.effects[q + 1].starttime);
                    //}
                    beatCh.AddEffect(lef);
                }
                else                 // On-Off, NOT ramps
                {
                    int n = ((q + 1) % barDivs);
                    if ((n == firstBeat) || bars)
                    {
                        xEffect xef = xEffects.effects[q];
                        Effect  lef = new Effect();
                        lef.EffectType       = EffectType.Intensity;
                        lef.Intensity        = 100;
                        lef.startCentisecond = ms2cs(xef.starttime);
                        // If processing 'Bars' channel without Ramps, special handling is required
                        if (bars)
                        {
                            // Calculate a half bar for the end time
                            halfBar  = ms2cs(xef.endtime);
                            halfBar -= lef.startCentisecond;
                            halfBar /= 2;
                            //halfBar = ms2cs(halfBar);
                            lef.endCentisecond = (lef.startCentisecond + halfBar);
                        }
                        else
                        {
                            lef.endCentisecond = ms2cs(xef.endtime);
                        }
                        //if (q < (xEffects.effects.Count - 1))
                        //{
                        // Alternative
                        //	lef.endCentisecond = ms2cs(xEffects.effects[q].starttime);
                        //}
                        beatCh.AddEffect(lef);
                    }
                }
            }             // end for loop
            return(errs);
        }
Example #32
0
     // -----------------------------------------------------------------------------
     // This utility function handles the removal of the xEffect and
     // should never be called directly except in Effects_h
     // -----------------------------------------------------------------------------
     public int Effects_HandleRemoveEffectSwarm(xEffect eEffect)
     {
          LogTrace(EngineConstants.LOG_CHANNEL_COMBAT_ABILITY, "Swarm Removal = " + GetTag(gameObject));

          // if this ability is being removed from a dying/dead creature
          if ((IsDeadOrDying(gameObject) != EngineConstants.FALSE) || (GetHasEffects(gameObject, EngineConstants.EFFECT_TYPE_DEATH) != EngineConstants.FALSE) || (GetCreatureFlag(gameObject, EngineConstants.CREATURE_RULES_FLAG_DYING) != EngineConstants.FALSE))
          {
               // if there are jumps left
               int nJumps = GetEffectIntegerRef(ref eEffect, 1);
               LogTrace(EngineConstants.LOG_CHANNEL_COMBAT_ABILITY, "  Jumps Remaining = " + ToString(nJumps));
               if (nJumps > 0)
               {
                    // find nearest enemy in range
                    GameObject oOwner = GetEffectObjectRef(ref eEffect, 0);
                    LogTrace(EngineConstants.LOG_CHANNEL_COMBAT_ABILITY, "  Owner = " + GetTag(oOwner));
                    List<GameObject> oTargets = GetObjectsInShape(EngineConstants.OBJECT_TYPE_CREATURE, EngineConstants.SHAPE_SPHERE, GetLocation(gameObject), EngineConstants.SWARM_RANGE, 0.0f, 0.0f, EngineConstants.TRUE);
                    int nMax = GetArraySize(oTargets);
                    LogTrace(EngineConstants.LOG_CHANNEL_COMBAT_ABILITY, "  Non-Dead Creatures Nearby = " + ToString(nMax));
                    int nCount;
                    int nTarget = -1;

                    for (nCount = 0; nCount < nMax; nCount++)
                    {
                         LogTrace(EngineConstants.LOG_CHANNEL_COMBAT_ABILITY, "    Creature " + ToString(nCount) + " = " + GetTag(oTargets[nCount]));
                         if (oTargets[nCount] != gameObject)
                         {
                              if (IsObjectHostile(oTargets[nCount], oOwner) != EngineConstants.FALSE)
                              {
                                   LogTrace(EngineConstants.LOG_CHANNEL_COMBAT_ABILITY, "      Hostile");
                                   if (CheckLineOfSightObject(gameObject, oTargets[nCount]) != EngineConstants.FALSE)
                                   {
                                        LogTrace(EngineConstants.LOG_CHANNEL_COMBAT_ABILITY, "      Line of Sight");
                                        nTarget = nCount;
                                        nCount = nMax;
                                   }
                              }
                         }
                    }
                    LogTrace(EngineConstants.LOG_CHANNEL_COMBAT_ABILITY, "  Final Target = " + ToString(nTarget));

                    // if one exists
                    if ((nTarget >= 0) && (nTarget < nMax))
                    {
                         int nAbility = GetEffectIntegerRef(ref eEffect, 0);
                         float fDamage = GetEffectFloatRef(ref eEffect, 0);
                         nJumps--;

                         // create event
                         xEvent ev = Event(90210);
                         SetEventIntegerRef(ref ev, 0, nAbility);
                         SetEventIntegerRef(ref ev, 1, nJumps);
                         SetEventObjectRef(ref ev, 0, oOwner);//oTargets[nTarget]);
                         SetEventObjectRef(ref ev, 1, oTargets[nTarget]);
                         //SetEventObjectRef(ref ev, 2, oOwner);
                         SetEventFloatRef(ref ev, 0, fDamage);

                         // fire projectile
                         Vector3 v = GetPosition(gameObject);
                         v.z += 1.5f;
                         GameObject oProjectile = FireHomingProjectile(EngineConstants.SWARM_PROJECTILE, v, oTargets[nTarget], 0, oTargets[nTarget]);
                         SetProjectileImpactEvent(oProjectile, ev);
                    }
               }
          }

          return EngineConstants.TRUE;
     }
Example #33
0
        public string xTimingsOutX(xTimings timings, xTimings.LabelTypes labelType, bool indent = false)
        {
            string label  = "";
            string level0 = "";
            string level1 = "  ";
            string level2 = "    ";

            if (indent)
            {
                level0 = "  ";
                level1 = "    ";
                level2 = "      ";
            }
            xEffect effect = null;

            StringBuilder ret = new StringBuilder();

            //  <timing
            ret.Append(level0);
            ret.Append(xTimings.RECORD_start);
            ret.Append(xTimings.TABLE_timing);
            ret.Append(xTimings.SPC);
            //  name="the Name"
            ret.Append(xTimings.FIELD_name);
            ret.Append(xTimings.VALUE_start);
            ret.Append(timings.timingName);
            ret.Append(xTimings.VALUE_end);
            ret.Append(xTimings.SPC);
            //  SourceVersion="2019.21">
            ret.Append(xTimings.FIELD_source);
            ret.Append(xTimings.VALUE_start);
            ret.Append(timings.sourceVersion);
            ret.Append(xTimings.VALUE_end);
            ret.Append(xTimings.RECORD_end);
            ret.Append(xTimings.CRLF);
            //    <EffectLayer>
            ret.Append(level1);
            ret.Append(xTimings.RECORD_start);
            ret.Append(xTimings.TABLE_layers);
            ret.Append(xTimings.RECORD_end);
            ret.Append(xTimings.CRLF);

            for (int i = 0; i < timings.effects.Count; i++)
            {
                effect = timings.effects[i];
                ret.Append(level2);
                ret.Append(xTimings.RECORD_start);
                ret.Append(xEffect.TABLE_Effect);
                ret.Append(xTimings.SPC);
                //  label="foo"
                ret.Append(xEffect.FIELD_label);
                ret.Append(xTimings.VALUE_start);
                switch (labelType)
                {
                case xTimings.LabelTypes.None:
                    // Append Nothing!
                    break;

                case xTimings.LabelTypes.Numbers:
                    ret.Append(effect.xlabel);
                    break;

                case xTimings.LabelTypes.NoteNames:
                    label = "";
                    if (effect.Midi >= 0 && effect.Midi <= 127)
                    {
                        //label = SequenceFunctions.noteNames[timings.effects[i].Midi];
                        label = xUtils.noteNames[effect.Midi];
                    }
                    ret.Append(label);
                    break;

                case xTimings.LabelTypes.MidiNumbers:
                    ret.Append(effect.Midi.ToString());
                    break;

                case xTimings.LabelTypes.KeyNumbers:
                    ret.Append(effect.Midi.ToString());
                    break;

                case xTimings.LabelTypes.KeyNames:
                    label = "";
                    if (effect.Midi >= 0 && effect.Midi <= 24)
                    {
                        label = SequenceFunctions.keyNames[effect.Midi];
                    }
                    ret.Append(label);
                    break;

                case xTimings.LabelTypes.Letters:
                    ret.Append(effect.xlabel);
                    break;

                case xTimings.LabelTypes.Frequency:
                    label = "";
                    if (effect.Midi >= 0 && effect.Midi <= 127)
                    {
                        label = SequenceFunctions.noteFreqs[effect.Midi];
                    }
                    ret.Append(label);
                    break;
                }
                ret.Append(xTimings.VALUE_end);
                ret.Append(xTimings.SPC);
                //  starttime="50"
                ret.Append(xEffect.FIELD_start);
                ret.Append(xTimings.VALUE_start);
                ret.Append(timings.effects[i].starttime.ToString());
                ret.Append(xTimings.VALUE_end);
                ret.Append(xTimings.SPC);
                //  endtime="350" />
                ret.Append(xEffect.FIELD_end);
                ret.Append(xTimings.VALUE_start);
                ret.Append(timings.effects[i].endtime.ToString());
                ret.Append(xTimings.VALUE_end);
                ret.Append(xTimings.SPC);

                ret.Append(xEffect.RECORD_end);
                ret.Append(xTimings.CRLF);
            }

            //     </EffectLayer>
            ret.Append(level1);
            ret.Append(xTimings.RECORDS_done);
            ret.Append(xTimings.TABLE_layers);
            ret.Append(xTimings.RECORD_end);
            ret.Append(xTimings.CRLF);
            //  </timing>
            ret.Append(level0);
            ret.Append(xTimings.RECORDS_done);
            ret.Append(xTimings.TABLE_timing);
            ret.Append(xTimings.RECORD_end);

            return(ret.ToString());
        }