예제 #1
0
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_stealEffect   = LogicDataTables.GetEffectByName(this.GetValue("StealEffect", 0), this);
            this.m_collectEffect = LogicDataTables.GetEffectByName(this.GetValue("CollectEffect", 0), this);

            this.m_resourceIconExportName = this.GetValue("ResourceIconExportName", 0);
            this.m_stealLimitMid          = this.GetIntegerValue("StealLimitMid", 0);
            this.m_stealEffectMid         = LogicDataTables.GetEffectByName(this.GetValue("StealEffectMid", 0), this);
            this.m_stealLimitBig          = this.GetIntegerValue("StealLimitBig", 0);
            this.m_stealEffectBig         = LogicDataTables.GetEffectByName(this.GetValue("StealEffectBig", 0), this);
            this.m_premiumCurrency        = this.GetBooleanValue("PremiumCurrency", 0);
            this.m_hudInstanceName        = this.GetValue("HudInstanceName", 0);
            this.m_capFullTID             = this.GetValue("CapFullTID", 0);
            this.m_textRed              = this.GetIntegerValue("TextRed", 0);
            this.m_textGreen            = this.GetIntegerValue("TextGreen", 0);
            this.m_textBlue             = this.GetIntegerValue("TextBlue", 0);
            this.m_bundleIconExportName = this.GetValue("BundleIconExportName", 0);
            this.m_villageType          = this.GetIntegerValue("VillageType", 0);

            if ((uint)this.m_villageType >= 2)
            {
                Debugger.Error("invalid VillageType");
            }

            string warRefResource = this.GetValue("WarRefResource", 0);

            if (warRefResource.Length > 0)
            {
                this.m_warResourceReferenceData = LogicDataTables.GetResourceByName(warRefResource, this);
            }
        }
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_disabled           = this.GetBooleanValue("Disabled", 0);
            this.m_tileX100           = this.GetIntegerValue("TileX100", 0);
            this.m_tileY100           = this.GetIntegerValue("TileY100", 0);
            this.m_requiredTH         = this.GetIntegerValue("RequiredTH", 0);
            this.m_automaticUpgrades  = this.GetBooleanValue("AutomaticUpgrades", 0);
            this.m_requiresBuilder    = this.GetBooleanValue("RequiresBuilder", 0);
            this.m_pickUpEffect       = LogicDataTables.GetEffectByName(this.GetValue("PickUpEffect", 0), this);
            this.m_animX              = this.GetIntegerValue("AnimX", 0);
            this.m_animY              = this.GetIntegerValue("AnimY", 0);
            this.m_animID             = this.GetIntegerValue("AnimID", 0);
            this.m_animDir            = this.GetIntegerValue("AnimDir", 0);
            this.m_animVisibilityOdds = this.GetIntegerValue("AnimVisibilityOdds", 0);
            this.m_hasInfoScreen      = this.GetBooleanValue("HasInfoScreen", 0);
            this.m_unitHousing        = this.GetIntegerValue("UnitHousing", 0);
            this.m_housesUnits        = this.GetBooleanValue("HousesUnits", 0);
            this.m_allianceBuilding   = this.GetBooleanValue("AllianceBuilding", 0);


            this.m_shipyard = string.Equals("Shipyard", this.GetName());

            if (!this.m_shipyard)
            {
                this.m_shipyard = string.Equals("Shipyard2", this.GetName());
            }

            this.m_rowBoat = string.Equals("Rowboat", this.GetName());

            if (!this.m_rowBoat)
            {
                this.m_rowBoat = string.Equals("Rowboat2", this.GetName());
            }

            this.m_clanGate = string.Equals("ClanGate", this.GetName());

            this.m_upgradeLevelCount     = this.m_row.GetBiggestArraySize();
            this.m_buildCost             = new int[this.m_row.GetBiggestArraySize()];
            this.m_buildTime             = new int[this.m_row.GetBiggestArraySize()];
            this.m_requiredTownHallLevel = new int[this.m_row.GetBiggestArraySize()];

            for (int i = 0; i < this.m_upgradeLevelCount; i++)
            {
                this.m_requiredTownHallLevel[i] = this.GetClampedIntegerValue("RequiredTownHall", i);
                this.m_buildCost[i]             = this.GetClampedIntegerValue("BuildCost", i);
                this.m_buildTime[i]             = 86400 * this.GetClampedIntegerValue("BuildTimeD", i) +
                                                  3600 * this.GetClampedIntegerValue("BuildTimeH", i) +
                                                  60 * this.GetClampedIntegerValue("BuildTimeM", i) +
                                                  this.GetClampedIntegerValue("BuildTimeS", i);
            }

            this.m_buildResourceData = LogicDataTables.GetResourceByName(this.GetValue("BuildResource", 0), this);
        }
예제 #3
0
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_swf              = this.GetValue("SWF", 0);
            this.m_exportName       = this.GetValue("ExportName", 0);
            this.m_shadowSWF        = this.GetValue("ShadowSWF", 0);
            this.m_shadowExportName = this.GetValue("ShadowExportName", 0);

            this.m_startHeight       = this.GetIntegerValue("StartHeight", 0);
            this.m_startOffset       = this.GetIntegerValue("StartOffset", 0);
            this.m_randomHitPosition = this.GetBooleanValue("RandomHitPosition", 0);

            string particleEmiter = this.GetValue("ParticleEmitter", 0);

            if (particleEmiter.Length > 0)
            {
                this.m_particleEmiterData = LogicDataTables.GetParticleEmitterByName(particleEmiter, this);
            }

            this.m_ballistic   = this.GetBooleanValue("IsBallistic", 0);
            this.m_speed       = (this.GetIntegerValue("Speed", 0) << 9) / 100;
            this.m_playOnce    = this.GetBooleanValue("PlayOnce", 0);
            this.m_useRotate   = this.GetBooleanValue("UseRotate", 0);
            this.m_useTopLayer = this.GetBooleanValue("UseTopLayer", 0);
            this.m_scale       = this.GetIntegerValue("Scale", 0);

            if (this.m_scale == 0)
            {
                this.m_scale = 100;
            }


            this.m_slowdownDefensePercent = this.GetIntegerValue("SlowdownDefencePercent", 0);
            this.m_hitSpellData           = LogicDataTables.GetSpellByName(this.GetValue("HitSpell", 0), this);
            this.m_hitSpellLevel          = this.GetIntegerValue("HitSpellLevel", 0);
            this.m_trackTarget            = this.GetBooleanValue("DontTrackTarget", 0) ^ true;
            this.m_ballisticHeight        = this.GetIntegerValue("BallisticHeight", 0);
            this.m_trajectoryStyle        = this.GetIntegerValue("TrajectoryStyle", 0);
            this.m_fixedTravelTime        = this.GetIntegerValue("FixedTravelTime", 0);
            this.m_damageDelay            = this.GetIntegerValue("DamageDelay", 0);
            this.m_useDirection           = this.GetBooleanValue("UseDirections", 0);
            this.m_scaleTimeline          = this.GetBooleanValue("ScaleTimeline", 0);
            this.m_targetPosRandomRadius  = this.GetIntegerValue("TargetPosRandomRadius", 0);
            this.m_directionFrame         = this.GetBooleanValue("DirectionFrame", 0);
            this.m_effectData             = LogicDataTables.GetEffectByName(this.GetValue("Effect", 0), this);
            this.m_destroyedEffectData    = LogicDataTables.GetEffectByName(this.GetValue("DestroyedEffect", 0), this);
            this.m_bounceEffectData       = LogicDataTables.GetEffectByName(this.GetValue("BounceEffect", 0), this);
        }
예제 #4
0
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_width  = this.GetIntegerValue("Width", 0);
            this.m_height = this.GetIntegerValue("Height", 0);

            this.m_upgradeLevelCount = this.m_row.GetBiggestArraySize();

            this.m_buildCost         = new int[this.m_upgradeLevelCount];
            this.m_rearmCost         = new int[this.m_upgradeLevelCount];
            this.m_townHallLevel     = new int[this.m_upgradeLevelCount];
            this.m_strenghtWeight    = new int[this.m_upgradeLevelCount];
            this.m_damage            = new int[this.m_upgradeLevelCount];
            this.m_damageRadius      = new int[this.m_upgradeLevelCount];
            this.m_ejectHousingLimit = new int[this.m_upgradeLevelCount];
            this.m_numSpawns         = new int[this.m_upgradeLevelCount];
            this.m_constructionTimes = new int[this.m_upgradeLevelCount];

            this.m_projectileData = new LogicProjectileData[this.m_upgradeLevelCount];

            for (int i = 0; i < this.m_upgradeLevelCount; i++)
            {
                this.m_buildCost[i]         = this.GetClampedIntegerValue("BuildCost", i);
                this.m_rearmCost[i]         = this.GetClampedIntegerValue("RearmCost", i);
                this.m_townHallLevel[i]     = LogicMath.Max(this.GetClampedIntegerValue("TownHallLevel", i) - 1, 0);
                this.m_strenghtWeight[i]    = this.GetClampedIntegerValue("StrengthWeight", i);
                this.m_damage[i]            = LogicGamePlayUtil.DPSToSingleHit(this.GetClampedIntegerValue("Damage", i), 1000);
                this.m_damageRadius[i]      = (this.GetClampedIntegerValue("DamageRadius", i) << 9) / 100;
                this.m_ejectHousingLimit[i] = this.GetIntegerValue("EjectHousingLimit", i);
                this.m_numSpawns[i]         = this.GetClampedIntegerValue("NumSpawns", i);
                this.m_constructionTimes[i] = 86400 * this.GetClampedIntegerValue("BuildTimeD", i) +
                                              3600 * this.GetClampedIntegerValue("BuildTimeH", i) +
                                              60 * this.GetClampedIntegerValue("BuildTimeM", i) +
                                              this.GetClampedIntegerValue("BuildTimeS", i);
                this.m_projectileData[i] = LogicDataTables.GetProjectileByName(this.GetValue("Projectile", i), this);
            }

            this.m_preferredTargetData      = LogicDataTables.GetCharacterByName(this.GetValue("PreferredTarget", 0), this);
            this.m_preferredTargetDamageMod = this.GetIntegerValue("PreferredTargetDamageMod", 0);

            if (this.m_preferredTargetDamageMod == 0)
            {
                this.m_preferredTargetDamageMod = 100;
            }

            this.m_buildResourceData = LogicDataTables.GetResourceByName(this.GetValue("BuildResource", 0), this);

            if (this.m_buildResourceData == null)
            {
                Debugger.Error("build resource is not defined for trap: " + this.GetName());
            }

            this.m_ejectVictims               = this.GetBooleanValue("EjectVictims", 0);
            this.m_actionFrame                = 1000 * this.GetIntegerValue("ActionFrame", 0) / 24;
            this.m_pushback                   = this.GetIntegerValue("Pushback", 0);
            this.m_doNotScalePushByDamage     = this.GetBooleanValue("DoNotScalePushByDamage", 0);
            this.m_effectData                 = LogicDataTables.GetEffectByName(this.GetValue("Effect", 0), this);
            this.m_effect2Data                = LogicDataTables.GetEffectByName(this.GetValue("Effect2", 0), this);
            this.m_effectBrokenData           = LogicDataTables.GetEffectByName(this.GetValue("EffectBroken", 0), this);
            this.m_damageEffectData           = LogicDataTables.GetEffectByName(this.GetValue("DamageEffect", 0), this);
            this.m_pickUpEffectData           = LogicDataTables.GetEffectByName(this.GetValue("PickUpEffect", 0), this);
            this.m_placingEffectData          = LogicDataTables.GetEffectByName(this.GetValue("PlacingEffect", 0), this);
            this.m_appearEffectData           = LogicDataTables.GetEffectByName(this.GetValue("AppearEffect", 0), this);
            this.m_toggleAttackModeEffectData = LogicDataTables.GetEffectByName(this.GetValue("ToggleAttackModeEffect", 0), this);
            this.m_triggerRadius              = (this.GetIntegerValue("TriggerRadius", 0) << 9) / 100;
            this.m_directionCount             = this.GetIntegerValue("DirectionCount", 0);
            this.m_spell                  = LogicDataTables.GetSpellByName(this.GetValue("Spell", 0), this);
            this.m_airTrigger             = this.GetBooleanValue("AirTrigger", 0);
            this.m_groundTrigger          = this.GetBooleanValue("GroundTrigger", 0);
            this.m_healerTrigger          = this.GetBooleanValue("HealerTrigger", 0);
            this.m_speedMod               = this.GetIntegerValue("SpeedMod", 0);
            this.m_damageMod              = this.GetIntegerValue("DamageMod", 0);
            this.m_durationMS             = this.GetIntegerValue("DurationMS", 0);
            this.m_hitDelayMS             = this.GetIntegerValue("HitDelayMS", 0);
            this.m_hitCount               = this.GetIntegerValue("HitCnt", 0);
            this.m_minTriggerHousingLimit = this.GetIntegerValue("MinTriggerHousingLimit", 0);
            this.m_spawnedCharGroundData  = LogicDataTables.GetCharacterByName(this.GetValue("SpawnedCharGround", 0), this);
            this.m_spawnedCharAirData     = LogicDataTables.GetCharacterByName(this.GetValue("SpawnedCharAir", 0), this);
            this.m_timeBetweenSpawnsMS    = this.GetIntegerValue("TimeBetweenSpawnsMs", 0);
            this.m_spawnInitialDelayMS    = this.GetIntegerValue("SpawnInitialDelayMs", 0);
            this.m_throwDistance          = this.GetIntegerValue("ThrowDistance", 0);
            this.m_hasAltMode             = this.GetBooleanValue("HasAltMode", 0);
            this.m_enableByCalendar       = this.GetBooleanValue("EnabledByCalendar", 0);

            if (this.m_enableByCalendar)
            {
                if (this.m_upgradeLevelCount > 1)
                {
                    Debugger.Error("Temporary traps should not have upgrade levels!");
                }
            }
        }
예제 #5
0
        public override void CreateReferences()
        {
            base.CreateReferences();

            int upgradeLevelCount = this.GetUpgradeLevelCount();

            this.m_attackerItemData         = new LogicAttackerItemData[upgradeLevelCount];
            this.m_specialAbilityEffectData = new LogicEffectData[upgradeLevelCount];
            this.m_auraSpellData            = new LogicSpellData[upgradeLevelCount];
            this.m_retributionSpellData     = new LogicSpellData[upgradeLevelCount];
            this.m_deployEffectData         = new LogicEffectData[upgradeLevelCount];
            this.m_dieEffectData            = new LogicEffectData[upgradeLevelCount];
            this.m_dieEffect2Data           = new LogicEffectData[upgradeLevelCount];
            this.m_dieDamageEffectData      = new LogicEffectData[upgradeLevelCount];
            this.m_moveTrailEffectData      = new LogicEffectData[upgradeLevelCount];

            this.m_hitpoints                = new int[upgradeLevelCount];
            this.m_secondaryTroopCount      = new int[upgradeLevelCount];
            this.m_unitsInCamp              = new int[upgradeLevelCount];
            this.m_strengthWeight           = new int[upgradeLevelCount];
            this.m_specialAbilityLevel      = new int[upgradeLevelCount];
            this.m_specialAbilityAttribute  = new int[upgradeLevelCount];
            this.m_specialAbilityAttribute2 = new int[upgradeLevelCount];
            this.m_specialAbilityAttribute3 = new int[upgradeLevelCount];
            this.m_scale                         = new int[upgradeLevelCount];
            this.m_attackCount                   = new int[upgradeLevelCount];
            this.m_abilityAttackCount            = new int[upgradeLevelCount];
            this.m_dieDamage                     = new int[upgradeLevelCount];
            this.m_auraSpellLevel                = new int[upgradeLevelCount];
            this.m_retributionSpellLevel         = new int[upgradeLevelCount];
            this.m_retributionSpellTriggerHealth = new int[upgradeLevelCount];

            this.m_childTroopX = new int[3];
            this.m_childTroopY = new int[3];

            for (int i = 0; i < this.m_hitpoints.Length; i++)
            {
                this.m_attackerItemData[i] = new LogicAttackerItemData();
                this.m_attackerItemData[i].CreateReferences(this.m_row, this, i);

                this.m_hitpoints[i]                = this.GetClampedIntegerValue("Hitpoints", i);
                this.m_secondaryTroopCount[i]      = this.GetClampedIntegerValue("SecondaryTroopCnt", i);
                this.m_unitsInCamp[i]              = this.GetClampedIntegerValue("UnitsInCamp", i);
                this.m_specialAbilityLevel[i]      = this.GetClampedIntegerValue("SpecialAbilityLevel", i);
                this.m_specialAbilityEffectData[i] = LogicDataTables.GetEffectByName(this.GetClampedValue("SpecialAbilityEffect", i), this);
                this.m_deployEffectData[i]         = LogicDataTables.GetEffectByName(this.GetClampedValue("DeployEffect", i), this);
                this.m_dieEffectData[i]            = LogicDataTables.GetEffectByName(this.GetClampedValue("DieEffect", i), this);
                this.m_dieEffect2Data[i]           = LogicDataTables.GetEffectByName(this.GetClampedValue("DieEffect2", i), this);
                this.m_dieDamageEffectData[i]      = LogicDataTables.GetEffectByName(this.GetClampedValue("DieDamageEffect", i), this);
                this.m_moveTrailEffectData[i]      = LogicDataTables.GetEffectByName(this.GetClampedValue("MoveTrailEffect", i), this);
                this.m_attackCount[i]              = this.GetClampedIntegerValue("AttackCount", i);
                this.m_abilityAttackCount[i]       = this.GetClampedIntegerValue("AbilityAttackCount", i);
                this.m_dieDamage[i]                = this.GetClampedIntegerValue("DieDamage", i);
                this.m_strengthWeight[i]           = this.GetClampedIntegerValue("StrengthWeight", i);
                this.m_scale[i] = this.GetClampedIntegerValue("Scale", i);

                if (this.m_scale[i] == 0)
                {
                    this.m_scale[i] = 100;
                }

                this.m_auraSpellData[i]                 = LogicDataTables.GetSpellByName(this.GetClampedValue("AuraSpell", i), this);
                this.m_auraSpellLevel[i]                = this.GetClampedIntegerValue("AuraSpellLevel", i);
                this.m_retributionSpellData[i]          = LogicDataTables.GetSpellByName(this.GetClampedValue("RetributionSpell", i), this);
                this.m_retributionSpellLevel[i]         = this.GetClampedIntegerValue("RetributionSpellLevel", i);
                this.m_retributionSpellTriggerHealth[i] = this.GetClampedIntegerValue("RetributionSpellTriggerHealth", i);
                this.m_specialAbilityAttribute[i]       = this.GetClampedIntegerValue("SpecialAbilityAttribute", i);
                this.m_specialAbilityAttribute2[i]      = this.GetClampedIntegerValue("SpecialAbilityAttribute2", i);
                this.m_specialAbilityAttribute3[i]      = this.GetClampedIntegerValue("SpecialAbilityAttribute3", i);
            }

            this.m_moveStartsEffect   = LogicDataTables.GetEffectByName(this.GetValue("MoveStartsEffect", 0), this);
            this.m_specialAbilityType = this.GetSpecialAbilityTypeFromCSV();

            string specialAbilitySpell = this.GetValue("SpecialAbilitySpell", 0);

            if (specialAbilitySpell.Length > 0)
            {
                this.m_specialAbilitySpellData = LogicDataTables.GetSpellByName(specialAbilitySpell, this);
            }

            this.m_swf = this.GetValue("SWF", 0);
            this.m_specialAbilityName = this.GetValue("SpecialAbilityName", 0);
            this.m_specialAbilityInfo = this.GetValue("SpecialAbilityInfo", 0);
            this.m_bigPictureSWF      = this.GetValue("BigPictureSWF", 0);
            this.m_dieDamageRadius    = (this.GetIntegerValue("DieDamageRadius", 0) << 9) / 100;
            this.m_dieDamageDelay     = this.GetIntegerValue("DieDamageDelay", 0);

            if (this.m_dieDamageDelay > 4000)
            {
                Debugger.Warning("m_dieDamageDelay too big");
                this.m_dieDamageDelay = 4000;
            }

            this.m_secondaryTroopData     = LogicDataTables.GetCharacterByName(this.GetValue("SecondaryTroop", 0), this);
            this.m_isSecondaryTroop       = this.GetBooleanValue("IsSecondaryTroop", 0);
            this.m_secondarySpawnDistance = (this.GetIntegerValue("SecondarySpawnDist", 0) << 9) / 100;
            this.m_secondarySpawnOffset   = (this.GetIntegerValue("SecondarySpawnOffset", 0) << 9) / 100;
            this.m_tombstoneData          = LogicDataTables.GetObstacleByName(this.GetValue("TombStone", 0), this);
            this.m_maxTrainingCount       = this.GetIntegerValue("MaxTrainingCount", 0);
            this.m_unlockedBarrackLevel   = this.GetIntegerValue("BarrackLevel", 0) - 1;
            this.m_flying = this.GetBooleanValue("IsFlying", 0);
            this.m_jumper = this.GetBooleanValue("IsJumper", 0);
            this.m_movementOffsetAmount = this.GetIntegerValue("MovementOffsetAmount", 0);
            this.m_movementOffsetSpeed  = this.GetIntegerValue("MovementOffsetSpeed", 0);
            this.m_balloonGoblin        = this.GetName().Equals("Balloon Goblin");
            this.m_spawnIdle            = this.GetIntegerValue("SpawnIdle", 0);
            this.m_childTroopData       = LogicDataTables.GetCharacterByName(this.GetValue("ChildTroop", 0), this);
            this.m_childTroopCount      = this.GetIntegerValue("ChildTroopCount", 0);

            for (int i = 0; i < 3; i++)
            {
                this.m_childTroopX[i] = this.GetIntegerValue(string.Format("ChildTroop{0}_X", i), 0);
                this.m_childTroopY[i] = this.GetIntegerValue(string.Format("ChildTroop{0}_Y", i), 0);
            }

            this.m_attackMultipleBuildings = this.GetBooleanValue("AttackMultipleBuildings", 0);

            if (!this.m_attackerItemData[0].IsSelfAsAoeCenter())
            {
                this.m_attackMultipleBuildings = false;
            }

            this.m_speed = (this.GetIntegerValue("Speed", 0) << 9) / 100;
            this.m_speedDecreasePerChildTroopLost = (this.GetIntegerValue("SpeedDecreasePerChildTroopLost", 0) << 9) / 100;
            this.m_pickNewTargetAfterPushback     = this.GetBooleanValue("PickNewTargetAfterPushback", 0);
            this.m_pushbackSpeed            = this.GetIntegerValue("PushbackSpeed", 0);
            this.m_hitEffectOffset          = this.GetIntegerValue("HitEffectOffset", 0);
            this.m_targetedEffectOffset     = (this.GetIntegerValue("TargetedEffectOffset", 0) << 9) / 100;
            this.m_randomizeSecSpawnDist    = this.GetBooleanValue("RandomizeSecSpawnDist", 0);
            this.m_customDefenderIcon       = this.GetValue("CustonDefenderIcon", 0);
            this.m_autoMergeDistance        = (this.GetIntegerValue("AutoMergeDistance", 0) << 9) / 100;
            this.m_autoMergeGroupSize       = this.GetIntegerValue("AutoMergeGroupSize", 0);
            this.m_invisibilityRadius       = (this.GetIntegerValue("InvisibilityRadius", 0) << 9) / 100;
            this.m_healthReductionPerSecond = this.GetIntegerValue("HealthReductionPerSecond", 0);
            this.m_isUnderground            = this.GetBooleanValue("IsUnderground", 0);
            this.m_attackOverWalls          = this.GetBooleanValue("NoAttackOverWalls", 0) ^ true;
            this.m_smoothJump  = this.GetBooleanValue("SmoothJump", 0);
            this.m_auraTID     = this.GetValue("AuraTID", 0);
            this.m_auraDescTID = this.GetValue("AuraDescTID", 0);
            this.m_auraBigPictureExportName = this.GetValue("AuraBigPictureExportName", 0);
            this.m_friendlyGroupWeight      = this.GetIntegerValue("FriendlyGroupWeight", 0);
            this.m_enemyGroupWeight         = this.GetIntegerValue("EnemyGroupWeight", 0);
            this.m_scaleByTH             = this.GetBooleanValue("ScaleByTH", 0);
            this.m_disableDonate         = this.GetBooleanValue("DisableDonate", 0);
            this.m_loseHpPerTick         = this.GetIntegerValue("LoseHpPerTick", 0);
            this.m_loseHpInterval        = this.GetIntegerValue("LoseHpInterval", 0);
            this.m_triggersTraps         = this.GetBooleanValue("TriggersTraps", 0);
            this.m_chainShootingDistance = this.GetIntegerValue("ChainShootingDistance", 0);
            this.m_boostedIfAlone        = this.GetBooleanValue("BoostedIfAlone", 0);
            this.m_boostRadius           = (this.GetIntegerValue("BoostRadius", 0) << 9) / 100;
            this.m_boostDamagePerfect    = this.GetIntegerValue("BoostDmgPerfect", 0);
            this.m_boostAttackSpeed      = this.GetIntegerValue("BoostAttackSpeed", 0);
        }
예제 #6
0
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_maxSearchRadiusForDefender = (this.GetIntegerValue("MaxSearchRadiusForDefender", 0) << 9) / 100;

            int biggestArraySize = this.m_row.GetBiggestArraySize();

            this.m_abilitySpellData                 = new LogicSpellData[biggestArraySize];
            this.m_regenerationTimeSecs             = new int[biggestArraySize];
            this.m_requiredTownHallLevel            = new int[biggestArraySize];
            this.m_abilityTime                      = new int[biggestArraySize];
            this.m_abilitySpeedBoost                = new int[biggestArraySize];
            this.m_abilitySpeedBoost2               = new int[biggestArraySize];
            this.m_abilityDamageBoostPercent        = new int[biggestArraySize];
            this.m_abilitySummonTroopCount          = new int[biggestArraySize];
            this.m_abilityHealthIncrease            = new int[biggestArraySize];
            this.m_abilityShieldProjectileSpeed     = new int[biggestArraySize];
            this.m_abilityShieldProjectileDamageMod = new int[biggestArraySize];
            this.m_abilitySpellLevel                = new int[biggestArraySize];
            this.m_abilityDamageBoostOffset         = new int[biggestArraySize];
            this.m_abilityDamageBoost               = new int[biggestArraySize];
            this.m_strengthWeight2                  = new int[biggestArraySize];

            for (int i = 0; i < biggestArraySize; i++)
            {
                this.m_regenerationTimeSecs[i]             = 60 * this.GetClampedIntegerValue("RegenerationTimeMinutes", i);
                this.m_requiredTownHallLevel[i]            = this.GetClampedIntegerValue("RequiredTownHallLevel", i) - 1;
                this.m_abilityTime[i]                      = this.GetClampedIntegerValue("AbilityTime", i);
                this.m_abilitySpeedBoost[i]                = this.GetClampedIntegerValue("AbilitySpeedBoost", i);
                this.m_abilitySpeedBoost2[i]               = this.GetClampedIntegerValue("AbilitySpeedBoost2", i);
                this.m_abilityDamageBoostPercent[i]        = this.GetClampedIntegerValue("AbilityDamageBoostPercent", i);
                this.m_abilitySummonTroopCount[i]          = this.GetClampedIntegerValue("AbilitySummonTroopCount", i);
                this.m_abilityHealthIncrease[i]            = this.GetClampedIntegerValue("AbilityHealthIncrease", i);
                this.m_abilityShieldProjectileSpeed[i]     = this.GetClampedIntegerValue("AbilityShieldProjectileSpeed", i);
                this.m_abilityShieldProjectileDamageMod[i] = this.GetClampedIntegerValue("AbilityShieldProjectileDamageMod", i);
                this.m_abilitySpellData[i]                 = LogicDataTables.GetSpellByName(this.GetClampedValue("AbilitySpell", i), this);
                this.m_abilitySpellLevel[i]                = this.GetClampedIntegerValue("AbilitySpellLevel", i);
                this.m_abilityDamageBoostOffset[i]         = this.GetClampedIntegerValue("AbilityDamageBoostOffset", i);

                int damage = this.m_attackerItemData[i].GetDamagePerMS(0, false);
                int offset = this.m_abilityDamageBoostOffset[i];

                this.m_abilityDamageBoost[i] = (100 * (damage + offset) + damage / 2) / damage - 100;
                this.m_strengthWeight2[i]    = this.GetClampedIntegerValue("StrengthWeight2", i);
            }

            this.m_alertRadius                 = (this.GetIntegerValue("AlertRadius", 0) << 9) / 100;
            this.m_abilityStealth              = this.GetBooleanValue("AbilityStealth", 0);
            this.m_abilityRadius               = this.GetIntegerValue("AbilityRadius", 0);
            this.m_abilityAffectsHero          = this.GetBooleanValue("AbilityAffectsHero", 0);
            this.m_abilityAffectsCharacterData = LogicDataTables.GetCharacterByName(this.GetValue("AbilityAffectsCharacter", 0), this);
            this.m_abilityTriggerEffectData    = LogicDataTables.GetEffectByName(this.GetValue("AbilityTriggerEffect", 0), this);
            this.m_abilityOnce                 = this.GetBooleanValue("AbilityOnce", 0);
            this.m_abilityCooldown             = this.GetIntegerValue("AbilityCooldown", 0);
            this.m_abilitySummonTroopData      = LogicDataTables.GetCharacterByName(this.GetValue("AbilitySummonTroop", 0), this);
            this.m_specialAbilityEffectData    = LogicDataTables.GetEffectByName(this.GetValue("SpecialAbilityEffect", 0), this);
            this.m_celebreateEffectData        = LogicDataTables.GetEffectByName(this.GetValue("CelebrateEffect", 0), this);
            this.m_sleepOffsetX                = (this.GetIntegerValue("SleepOffsetX", 0) << 9) / 100;
            this.m_sleepOffsetY                = (this.GetIntegerValue("SleepOffsetY", 0) << 9) / 100;
            this.m_patrolRadius                = (this.GetIntegerValue("PatrolRadius", 0) << 9) / 100;
            this.m_smallPictureSWF             = this.GetValue("SmallPictureSWF", 0);
            this.m_smallPicture                = this.GetValue("SmallPicture", 0);
            this.m_abilityTID     = this.GetValue("AbilityTID", 0);
            this.m_abilityDescTID = this.GetValue("AbilityDescTID", 0);
            this.m_abilityIcon    = this.GetValue("AbilityIcon", 0);
            this.m_abilityDelay   = this.GetIntegerValue("AbilityDelay", 0);
            this.m_abilityBigPictureExportName = this.GetValue("AbilityBigPictureExportName", 0);
            this.m_hasAltMode     = this.GetBooleanValue("HasAltMode", 0);
            this.m_altModeFlying  = this.GetBooleanValue("AltModeFlying", 0);
            this.m_noDefence      = this.GetBooleanValue("NoDefence", 0);
            this.m_activationTime = this.GetIntegerValue("ActivationTime", 0);
            this.m_activeDuration = this.GetIntegerValue("ActiveDuration", 0);
        }
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_damage                     = new int[this.m_upgradeLevelCount];
            this.m_troopDamagePermil          = new int[this.m_upgradeLevelCount];
            this.m_buildingDamagePermil       = new int[this.m_upgradeLevelCount];
            this.m_executeHealthPermil        = new int[this.m_upgradeLevelCount];
            this.m_damagePermilMin            = new int[this.m_upgradeLevelCount];
            this.m_preferredDamagePermilMin   = new int[this.m_upgradeLevelCount];
            this.m_boostTimeMS                = new int[this.m_upgradeLevelCount];
            this.m_speedBoost                 = new int[this.m_upgradeLevelCount];
            this.m_speedBoost2                = new int[this.m_upgradeLevelCount];
            this.m_damageBoostPercent         = new int[this.m_upgradeLevelCount];
            this.m_duplicateLifetime          = new int[this.m_upgradeLevelCount];
            this.m_duplicateHousing           = new int[this.m_upgradeLevelCount];
            this.m_radius                     = new int[this.m_upgradeLevelCount];
            this.m_numberOfHits               = new int[this.m_upgradeLevelCount];
            this.m_randomRadius               = new int[this.m_upgradeLevelCount];
            this.m_timeBetweenHitsMS          = new int[this.m_upgradeLevelCount];
            this.m_jumpBoostMS                = new int[this.m_upgradeLevelCount];
            this.m_jumpHousingLimit           = new int[this.m_upgradeLevelCount];
            this.m_freezeTimeMS               = new int[this.m_upgradeLevelCount];
            this.m_strengthWeight             = new int[this.m_upgradeLevelCount];
            this.m_buildingDamageBoostPercent = new int[this.m_upgradeLevelCount];
            this.m_shieldProjectileSpeed      = new int[this.m_upgradeLevelCount];
            this.m_shieldProjectileDamageMod  = new int[this.m_upgradeLevelCount];
            this.m_extraHealthPermil          = new int[this.m_upgradeLevelCount];
            this.m_extraHealthMin             = new int[this.m_upgradeLevelCount];
            this.m_extraHealthMax             = new int[this.m_upgradeLevelCount];
            this.m_poisonDamage               = new int[this.m_upgradeLevelCount];
            this.m_attackSpeedBoost           = new int[this.m_upgradeLevelCount];
            this.m_invulnerabilityTime        = new int[this.m_upgradeLevelCount];
            this.m_maxUnitsHit                = new int[this.m_upgradeLevelCount];
            this.m_unitsToSpawn               = new int[this.m_upgradeLevelCount];
            this.m_spawnDuration              = new int[this.m_upgradeLevelCount];

            this.m_preDeployEffect   = new LogicEffectData[this.m_upgradeLevelCount];
            this.m_deployEffect      = new LogicEffectData[this.m_upgradeLevelCount];
            this.m_deployEffect2     = new LogicEffectData[this.m_upgradeLevelCount];
            this.m_enemyDeployEffect = new LogicEffectData[this.m_upgradeLevelCount];
            this.m_chargingEffect    = new LogicEffectData[this.m_upgradeLevelCount];
            this.m_hitEffect         = new LogicEffectData[this.m_upgradeLevelCount];

            for (int i = 0; i < this.m_upgradeLevelCount; i++)
            {
                this.m_damage[i]                     = LogicGamePlayUtil.DPSToSingleHit(this.GetClampedIntegerValue("Damage", i), 1000);
                this.m_troopDamagePermil[i]          = this.GetClampedIntegerValue("TroopDamagePermil", i);
                this.m_buildingDamagePermil[i]       = this.GetClampedIntegerValue("BuildingDamagePermil", i);
                this.m_executeHealthPermil[i]        = this.GetClampedIntegerValue("ExecuteHealthPermil", i);
                this.m_damagePermilMin[i]            = this.GetClampedIntegerValue("DamagePermilMin", i);
                this.m_preferredDamagePermilMin[i]   = this.GetClampedIntegerValue("PreferredDamagePermilMin", i);
                this.m_boostTimeMS[i]                = this.GetClampedIntegerValue("BoostTimeMS", i);
                this.m_speedBoost[i]                 = this.GetClampedIntegerValue("SpeedBoost", i);
                this.m_speedBoost2[i]                = this.GetClampedIntegerValue("SpeedBoost2", i);
                this.m_damageBoostPercent[i]         = this.GetClampedIntegerValue("DamageBoostPercent", i);
                this.m_duplicateLifetime[i]          = this.GetClampedIntegerValue("DuplicateLifetime", i);
                this.m_duplicateHousing[i]           = this.GetClampedIntegerValue("DuplicateHousing", i);
                this.m_radius[i]                     = (this.GetClampedIntegerValue("Radius", i) << 9) / 100;
                this.m_numberOfHits[i]               = this.GetClampedIntegerValue("NumberOfHits", i);
                this.m_randomRadius[i]               = (this.GetClampedIntegerValue("RandomRadius", i) << 9) / 100;
                this.m_timeBetweenHitsMS[i]          = this.GetClampedIntegerValue("TimeBetweenHitsMS", i);
                this.m_jumpBoostMS[i]                = this.GetClampedIntegerValue("JumpBoostMS", i);
                this.m_jumpHousingLimit[i]           = this.GetClampedIntegerValue("JumpHousingLimit", i);
                this.m_hitEffect[i]                  = LogicDataTables.GetEffectByName(this.GetClampedValue("HitEffect", i), this);
                this.m_chargingEffect[i]             = LogicDataTables.GetEffectByName(this.GetClampedValue("ChargingEffect", i), this);
                this.m_preDeployEffect[i]            = LogicDataTables.GetEffectByName(this.GetClampedValue("PreDeployEffect", i), this);
                this.m_deployEffect[i]               = LogicDataTables.GetEffectByName(this.GetClampedValue("DeployEffect", i), this);
                this.m_enemyDeployEffect[i]          = LogicDataTables.GetEffectByName(this.GetClampedValue("EnemyDeployEffect", i), this);
                this.m_deployEffect2[i]              = LogicDataTables.GetEffectByName(this.GetClampedValue("DeployEffect2", i), this);
                this.m_freezeTimeMS[i]               = this.GetClampedIntegerValue("FreezeTimeMS", i);
                this.m_strengthWeight[i]             = this.GetClampedIntegerValue("StrengthWeight", i);
                this.m_buildingDamageBoostPercent[i] = this.GetClampedIntegerValue("BuildingDamageBoostPercent", i);
                this.m_shieldProjectileSpeed[i]      = this.GetClampedIntegerValue("ShieldProjectileSpeed", i);
                this.m_shieldProjectileDamageMod[i]  = this.GetClampedIntegerValue("ShieldProjectileDamageMod", i);
                this.m_extraHealthPermil[i]          = this.GetClampedIntegerValue("ExtraHealthPermil", i);
                this.m_extraHealthMin[i]             = this.GetClampedIntegerValue("ExtraHealthMin", i);
                this.m_extraHealthMax[i]             = this.GetClampedIntegerValue("ExtraHealthMax", i);
                this.m_poisonDamage[i]               = LogicGamePlayUtil.DPSToSingleHit(this.GetClampedIntegerValue("PoisonDPS", i), 1000);
                this.m_attackSpeedBoost[i]           = this.GetClampedIntegerValue("AttackSpeedBoost", i);
                this.m_invulnerabilityTime[i]        = this.GetClampedIntegerValue("InvulnerabilityTime", i);
                this.m_maxUnitsHit[i]                = this.GetClampedIntegerValue("MaxUnitsHit", i);
                this.m_unitsToSpawn[i]               = this.GetClampedIntegerValue("UnitsToSpawn", i);
                this.m_spawnDuration[i]              = this.GetClampedIntegerValue("SpawnDuration", i);
            }

            this.m_poisonIncreaseSlowly   = this.GetBooleanValue("PoisonIncreaseSlowly", 0);
            this.m_poisonAffectAir        = this.GetBooleanValue("PoisonAffectAir", 0);
            this.m_spawnFirstGroupSize    = this.GetIntegerValue("SpawnFirstGroupSize", 0);
            this.m_scaleByTownHall        = this.GetBooleanValue("ScaleByTH", 0);
            this.m_pauseCombatComponentMs = this.GetIntegerValue("PauseCombatComponentsMs", 0);
            this.m_damageTHPercent        = this.GetIntegerValue("DamageTHPercent", 0);

            if (this.m_damageTHPercent <= 0)
            {
                this.m_damageTHPercent = 100;
            }

            this.m_shrinkReduceSpeedRatio = this.GetIntegerValue("ShrinkReduceSpeedRatio", 0);
            this.m_shrinkHitpointsRatio   = this.GetIntegerValue("ShrinkHitpointsRatio", 0);
            this.m_deployEffect2Delay     = this.GetIntegerValue("DeployEffect2Delay", 0);
            this.m_hitTimeMS                  = this.GetIntegerValue("HitTimeMS", 0);
            this.m_deployTimeMS               = this.GetIntegerValue("DeployTimeMS", 0);
            this.m_chargingTimeMS             = this.GetIntegerValue("ChargingTimeMS", 0);
            this.m_spellForgeLevel            = this.GetIntegerValue("SpellForgeLevel", 0) - 1;
            this.m_randomRadiusAffectsOnlyGfx = this.GetBooleanValue("RandomRadiusAffectsOnlyGfx", 0);
            this.m_spawnObstacle              = LogicDataTables.GetObstacleByName(this.GetValue("SpawnObstacle", 0), this);
            this.m_numObstacles               = this.GetIntegerValue("NumObstacles", 0);
            this.m_troopsOnly                 = this.GetBooleanValue("TroopsOnly", 0);
            this.m_targetInfoString           = this.GetValue("TargetInfoString", 0);

            string preferredTarget = this.GetValue("PreferredTarget", 0);

            if (preferredTarget.Length != 0)
            {
                this.m_preferredTarget = LogicDataTables.GetBuildingClassByName(preferredTarget, null);

                if (this.m_preferredTarget == null)
                {
                    this.m_preferredTarget = LogicDataTables.GetBuildingByName(preferredTarget, null);

                    if (this.m_preferredTarget == null)
                    {
                        this.m_preferredTarget = LogicDataTables.GetCharacterByName(preferredTarget, null);

                        if (this.m_preferredTarget == null)
                        {
                            Debugger.Warning(string.Format("CSV row ({0}) has an invalid reference ({1})", this.GetName(), preferredTarget));
                        }
                    }
                }
            }

            this.m_preferredTargetDamageMod = this.GetIntegerValue("PreferredTargetDamageMod", 0);

            if (this.m_preferredTargetDamageMod == 0)
            {
                this.m_preferredTargetDamageMod = 100;
            }

            this.m_heroDamageMultiplier = this.GetIntegerValue("HeroDamageMultiplier", 0);

            if (this.m_heroDamageMultiplier == 0)
            {
                this.m_heroDamageMultiplier = 100;
            }

            this.m_snapToGrid          = this.GetBooleanValue("SnapToGrid", 0);
            this.m_boostDefenders      = this.GetBooleanValue("BoostDefenders", 0);
            this.m_boostLinkedToPoison = this.GetBooleanValue("BoostLinkedToPoison", 0);
            this.m_scaleDeployEffects  = this.GetBooleanValue("ScaleDeployEffects", 0);
            this.m_summonTroop         = LogicDataTables.GetCharacterByName(this.GetValue("SummonTroop", 0), null);
        }
        public void CreateReferences(CSVRow row, LogicData data, int idx)
        {
            this.m_row   = row;
            this.m_data  = data;
            this.m_index = idx;

            this.m_pushBack      = row.GetClampedIntegerValue("PushBack", idx);
            this.m_airTargets    = row.GetClampedBooleanValue("AirTargets", idx);
            this.m_groundTargets = row.GetClampedBooleanValue("GroundTargets", idx);
            this.m_altAttackMode = row.GetClampedBooleanValue("AltAttackMode", idx);
            this.m_damage        = 100 * row.GetClampedIntegerValue("Damage", idx);

            int dps            = row.GetClampedIntegerValue("DPS", idx);
            int attackSpeed    = row.GetClampedIntegerValue("AttackSpeed", idx);
            int altDps         = row.GetClampedIntegerValue("AltDPS", idx);
            int altAttackSpeed = row.GetClampedIntegerValue("AltAttackSpeed", idx);

            if (this.m_altAttackMode && altAttackSpeed == 0)
            {
                altAttackSpeed = attackSpeed;
            }

            int cooldownOverride = row.GetClampedIntegerValue("CoolDownOverride", idx);

            if (cooldownOverride == 0)
            {
                int tmp = (int)(((dps | this.m_damage) >> 31) & 0xFFFFFAEC) + 1500;

                if (attackSpeed > tmp)
                {
                    cooldownOverride = attackSpeed - tmp;
                }
            }

            this.m_prepareSpeed = row.GetClampedIntegerValue("PrepareSpeed", idx);

            this.m_attackSpeed      = attackSpeed - cooldownOverride;
            this.m_altAttackSpeed   = altAttackSpeed - cooldownOverride;
            this.m_cooldownOverride = cooldownOverride;

            this.m_damageMulti = 100 * row.GetClampedIntegerValue("DamageMulti", idx);
            this.m_damageLvl2  = 100 * row.GetClampedIntegerValue("DamageLv2", idx);
            this.m_damageLvl3  = 100 * row.GetClampedIntegerValue("DamageLv3", idx);

            this.m_altDamage = this.m_damage;

            if (dps != 0)
            {
                if (altDps == 0)
                {
                    altDps = dps;
                }

                this.m_damage      = LogicGamePlayUtil.DPSToSingleHit(dps, this.m_attackSpeed + this.m_cooldownOverride);
                this.m_altDamage   = LogicGamePlayUtil.DPSToSingleHit(altDps, this.m_altAttackSpeed + this.m_cooldownOverride);
                this.m_damageMulti = LogicGamePlayUtil.DPSToSingleHit(row.GetClampedIntegerValue("DPSMulti", idx), this.m_attackSpeed + this.m_cooldownOverride);
                this.m_damageLvl2  = LogicGamePlayUtil.DPSToSingleHit(row.GetClampedIntegerValue("DPSLv2", idx), this.m_attackSpeed + this.m_cooldownOverride);
                this.m_damageLvl3  = LogicGamePlayUtil.DPSToSingleHit(row.GetClampedIntegerValue("DPSLv3", idx), this.m_attackSpeed + this.m_cooldownOverride);
            }

            this.m_hitEffectData       = LogicDataTables.GetEffectByName(row.GetClampedValue("HitEffect", idx), data);
            this.m_hitEffect2Data      = LogicDataTables.GetEffectByName(row.GetClampedValue("HitEffect2", idx), data);
            this.m_hitEffectActiveData = LogicDataTables.GetEffectByName(row.GetClampedValue("HitEffectActive", idx), data);

            this.m_attackRange  = (row.GetClampedIntegerValue("AttackRange", idx) << 9) / 100;
            this.m_damageRadius = (row.GetClampedIntegerValue("DamageRadius", idx) << 9) / 100;

            this.m_attackEffectData        = LogicDataTables.GetEffectByName(row.GetClampedValue("AttackEffect", idx), data);
            this.m_altAttackEffectData     = LogicDataTables.GetEffectByName(row.GetClampedValue("AttackEffectAlt", idx), data);
            this.m_ammoCount               = row.GetClampedIntegerValue("AmmoCount", idx);
            this.m_attackEffect2Data       = LogicDataTables.GetEffectByName(row.GetClampedValue("AttackEffect2", idx), data);
            this.m_attackEffectLv2Data     = LogicDataTables.GetEffectByName(row.GetClampedValue("AttackEffectLv2", idx), data);
            this.m_attackEffectLv3Data     = LogicDataTables.GetEffectByName(row.GetClampedValue("AttackEffectLv3", idx), data);
            this.m_transitionEffectLv2Data = LogicDataTables.GetEffectByName(row.GetClampedValue("TransitionEffectLv2", idx), data);
            this.m_transitionEffectLv3Data = LogicDataTables.GetEffectByName(row.GetClampedValue("TransitionEffectLv3", idx), data);
            this.m_altNumMultiTargets      = row.GetClampedIntegerValue("AltNumMultiTargets", idx);
            this.m_switchTimeLv2           = row.GetClampedIntegerValue("Lv2SwitchTime", idx);
            this.m_switchTimeLv3           = row.GetClampedIntegerValue("Lv3SwitchTime", idx);
            this.m_statusEffectTime        = row.GetClampedIntegerValue("StatusEffectTime", idx);
            this.m_speedMod              = row.GetClampedIntegerValue("SpeedMod", idx);
            this.m_altAttackRange        = (row.GetClampedIntegerValue("AltAttackRange", idx) << 9) / 100;
            this.m_projectileData        = LogicDataTables.GetProjectileByName(row.GetClampedValue("Projectile", idx), data);
            this.m_altProjectileData     = LogicDataTables.GetProjectileByName(row.GetClampedValue("AltProjectile", idx), data);
            this.m_shockwavePushStrength = row.GetClampedIntegerValue("ShockwavePushStrength", idx);
            this.m_hitSpellData          = LogicDataTables.GetSpellByName(row.GetClampedValue("HitSpell", idx), data);
            this.m_hitSpellLevel         = row.GetClampedIntegerValue("HitSpellLevel", idx);
            this.m_damage2             = 100 * row.GetClampedIntegerValue("Damage2", idx);
            this.m_damage2Radius       = (row.GetClampedIntegerValue("Damage2Radius", idx) << 9) / 100;
            this.m_damage2Delay        = row.GetClampedIntegerValue("Damage2Delay", idx);
            this.m_damage2Min          = 100 * row.GetClampedIntegerValue("Damage2Min", idx);
            this.m_damage2FalloffStart = (row.GetClampedIntegerValue("Damage2FalloffStart", idx) << 9) / 100;
            this.m_damage2FalloffEnd   = (row.GetClampedIntegerValue("Damage2FalloffStart", idx) << 9) / 100;

            if (this.m_damage2FalloffEnd < this.m_damage2FalloffStart)
            {
                Debugger.Error("Building " + row.GetName() + " has falloff end less than falloff start!");
            }

            if (this.m_damage2FalloffEnd > this.m_damage2Radius)
            {
                Debugger.Error("Building " + row.GetName() + " has falloff end greater than the damage radius!");
            }

            this.m_preAttackEffectData         = LogicDataTables.GetEffectByName(row.GetClampedValue("PreAttackEffect", idx), data);
            this.m_becomesTargetableEffectData = LogicDataTables.GetEffectByName(row.GetClampedValue("BecomesTargetableEffect", idx), data);
            this.m_increasingDamage            = row.GetClampedBooleanValue("IncreasingDamage", idx);
            this.m_preventsHealing             = row.GetClampedBooleanValue("PreventsHealing", idx);
            this.m_alternatePickNewTargetDelay = row.GetClampedIntegerValue("AlternatePickNewTargetDelay", idx);
            this.m_shockwaveArcLength          = row.GetClampedIntegerValue("ShockwaveArcLength", idx);
            this.m_shockwaveExpandRadius       = row.GetClampedIntegerValue("ShockwaveExpandRadius", idx);
            this.m_targetingConeAngle          = row.GetClampedIntegerValue("TargetingConeAngle", idx);
            this.m_penetratingProjectile       = row.GetClampedBooleanValue("PenetratingProjectile", idx);
            this.m_penetratingRadius           = (row.GetClampedIntegerValue("PenetratingRadius", idx) << 9) / 100;
            this.m_penetratingExtraRange       = (row.GetClampedIntegerValue("PenetratingExtraRange", idx) << 9) / 100;
            this.m_targetGroups               = row.GetClampedBooleanValue("TargetGroups", idx);
            this.m_fightWithGroups            = row.GetClampedBooleanValue("FightWithGroups", idx);
            this.m_targetGroupsRadius         = (row.GetClampedIntegerValue("TargetGroupsRadius", idx) << 9) / 100;
            this.m_targetGroupsRange          = (row.GetClampedIntegerValue("TargetGroupsRange", idx) << 9) / 100;
            this.m_targetGroupsMinWeight      = row.GetClampedIntegerValue("TargetGroupsMinWeight", idx);
            this.m_wakeUpSpace                = row.GetClampedIntegerValue("WakeUpSpace", idx);
            this.m_wakeUpSpeed                = row.GetClampedIntegerValue("WakeUpSpeed", idx);
            this.m_preferredTargetData        = LogicDataTables.GetCharacterByName(row.GetClampedValue("PreferredTarget", idx), data);
            this.m_preferredTargetDamageMod   = row.GetClampedIntegerValue("PreferredTargetDamageMod", idx);
            this.m_preferredTargetNoTargeting = row.GetClampedBooleanValue("PreferredTargetNoTargeting", idx);
            this.m_altAirTargets              = row.GetClampedBooleanValue("AltAirTargets", idx);
            this.m_altGroundTargets           = row.GetClampedBooleanValue("AltGroundTargets", idx);
            this.m_altMultiTargets            = row.GetClampedBooleanValue("AltMultiTargets", idx);
            this.m_minAttackRange             = (row.GetClampedIntegerValue("MinAttackRange", idx) << 9) / 100;

            if (this.m_preferredTargetData == null)
            {
                this.m_preferredTargetData = LogicDataTables.GetBuildingClassByName(row.GetClampedValue("PreferedTargetBuildingClass", idx), data);

                if (this.m_preferredTargetData == null)
                {
                    this.m_preferredTargetData = LogicDataTables.GetBuildingByName(row.GetClampedValue("PreferedTargetBuilding", idx), data);
                }

                this.m_preferredTargetDamageMod = row.GetClampedIntegerValue("PreferedTargetDamageMod", idx);

                if (this.m_preferredTargetDamageMod == 0)
                {
                    this.m_preferredTargetDamageMod = 100;
                }
            }

            this.m_summonTroopCount   = row.GetClampedIntegerValue("SummonTroopCount", idx);
            this.m_summonCooldown     = row.GetClampedIntegerValue("SummonCooldown", idx);
            this.m_summonEffectData   = LogicDataTables.GetEffectByName(row.GetClampedValue("SummonEffect", idx), data);
            this.m_summonLimit        = row.GetClampedIntegerValue("SummonLimit", idx);
            this.m_summonTroopData    = LogicDataTables.GetCharacterByName(row.GetClampedValue("SummonTroop", idx), data);
            this.m_spawnOnAttack      = row.GetClampedBooleanValue("SpawnOnAttack", idx);
            this.m_hideEffectData     = LogicDataTables.GetEffectByName(row.GetClampedValue("HideEffect", idx), data);
            this.m_rageProjectileData = LogicDataTables.GetProjectileByName(row.GetClampedValue("RageProjectile", idx), data);
            this.m_projectileBounces  = row.GetClampedIntegerValue("ProjectileBounces", idx);
            this.m_selfAsAoeCenter    = row.GetClampedBooleanValue("SelfAsAoeCenter", idx);

            if (this.m_damage2Delay > this.m_cooldownOverride + this.m_attackSpeed)
            {
                Debugger.Error(row.GetName() + " has Damage2Delay greater than the attack speed!");
            }

            if (this.m_ammoCount > 0 && (this.m_attackSpeed & 63) != 0)
            {
                Debugger.Error(string.Format("Invalid attack speed {0} (must be multiple of 64)", this.m_attackSpeed));
            }

            this.m_burstCount             = row.GetClampedIntegerValue("BurstCount", idx);
            this.m_burstDelay             = row.GetClampedIntegerValue("BurstDelay", idx);
            this.m_altBurstCount          = row.GetClampedIntegerValue("AltBurstCount", idx);
            this.m_altBurstDelay          = row.GetClampedIntegerValue("AltBurstDelay", idx);
            this.m_dummyProjectileCount   = row.GetClampedIntegerValue("DummyProjectileCount", idx);
            this.m_attackEffectSharedData = LogicDataTables.GetEffectByName(row.GetClampedValue("AttackEffectShared", idx), data);
            this.m_chainAttackDistance    = row.GetClampedIntegerValue("ChainAttackDistance", idx);
            this.m_newTargetAttackDelay   = row.GetClampedIntegerValue("NewTargetAttackDelay", idx);

            if (this.m_newTargetAttackDelay > 0)
            {
                this.m_newTargetAttackDelay = LogicMath.Clamp(attackSpeed - this.m_newTargetAttackDelay, 0, attackSpeed);
            }
        }
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_exportName              = this.GetValue("ExportName", 0);
            this.m_exportNameBase          = this.GetValue("ExportNameBase", 0);
            this.m_width                   = this.GetIntegerValue("Width", 0);
            this.m_height                  = this.GetIntegerValue("Height", 0);
            this.m_passable                = this.GetBooleanValue("Passable", 0);
            this.m_clearEffect             = LogicDataTables.GetEffectByName(this.GetValue("ClearEffect", 0), this);
            this.m_pickUpEffect            = LogicDataTables.GetEffectByName(this.GetValue("PickUpEffect", 0), this);
            this.m_isTombstone             = this.GetBooleanValue("IsTombstone", 0);
            this.m_tombGroup               = this.GetIntegerValue("TombGroup", 0);
            this.m_appearancePeriodHours   = this.GetIntegerValue("AppearancePeriodHours", 0);
            this.m_minRespawnTimeHours     = this.GetIntegerValue("MinRespawnTimeHours", 0);
            this.m_lootDefensePercentage   = this.GetIntegerValue("LootDefensePercentage", 0);
            this.m_redMul                  = this.GetIntegerValue("RedMul", 0);
            this.m_greenMul                = this.GetIntegerValue("GreenMul", 0);
            this.m_blueMul                 = this.GetIntegerValue("BlueMul", 0);
            this.m_redAdd                  = this.GetIntegerValue("RedAdd", 0);
            this.m_greenAdd                = this.GetIntegerValue("GreenAdd", 0);
            this.m_blueAdd                 = this.GetIntegerValue("BlueAdd", 0);
            this.m_lightsOn                = this.GetBooleanValue("LightsOn", 0);
            this.m_village2RespawnCount    = this.GetIntegerValue("Village2RespawnCount", 0);
            this.m_variationCount          = this.GetIntegerValue("VariationCount", 0);
            this.m_tallGrass               = this.GetBooleanValue("TallGrass", 0);
            this.m_tallGrassSpawnPoint     = this.GetBooleanValue("TallGrassSpawnPoint", 0);
            this.m_lootHighlightPercentage = this.GetIntegerValue("LootHighlightPercentage", 0);
            this.m_highlightExportName     = this.GetValue("HighlightExportName", 0);

            this.m_clearResourceData = LogicDataTables.GetResourceByName(this.GetValue("ClearResource", 0), this);

            if (this.m_clearResourceData == null)
            {
                Debugger.Error("Clear resource is not defined for obstacle: " + this.GetName());
            }

            this.m_clearCost     = this.GetIntegerValue("ClearCost", 0);
            this.m_clearTimeSecs = this.GetIntegerValue("ClearTimeSeconds", 0);
            this.m_respawnWeight = this.GetIntegerValue("RespawnWeight", 0);

            string lootResourceName = this.GetValue("LootResource", 0);

            if (lootResourceName.Length <= 0)
            {
                this.m_respawnWeight = 0;
            }
            else
            {
                this.m_lootResourceData = LogicDataTables.GetResourceByName(lootResourceName, this);
                this.m_lootCount        = this.GetIntegerValue("LootCount", 0);
            }

            this.m_lootMultiplierVersion2 = this.GetIntegerValue("LootMultiplierForVersion2", 0);

            if (this.m_lootMultiplierVersion2 == 0)
            {
                this.m_lootMultiplierVersion2 = 1;
            }

            string spawnObstacle = this.GetValue("SpawnObstacle", 0);

            if (spawnObstacle.Length > 0)
            {
                this.m_spawnObstacle        = LogicDataTables.GetObstacleByName(spawnObstacle, this);
                this.m_spawnRadius          = this.GetIntegerValue("SpawnRadius", 0);
                this.m_spawnIntervalSeconds = this.GetIntegerValue("SpawnIntervalSeconds", 0);
                this.m_spawnCount           = this.GetIntegerValue("SpawnCount", 0);
                this.m_maxSpawned           = this.GetIntegerValue("MaxSpawned", 0);
                this.m_maxLifetimeSpawns    = this.GetIntegerValue("MaxLifetimeSpawns", 0);
            }
        }
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_upgradeLevelCount = this.m_row.GetBiggestArraySize();
            this.m_buildingClass     = LogicDataTables.GetBuildingClassByName(this.GetValue("BuildingClass", 0), this);

            if (this.m_buildingClass == null)
            {
                Debugger.Error("Building class is not defined for " + this.GetName());
            }

            this.m_secondaryTargetingClass = LogicDataTables.GetBuildingClassByName(this.GetValue("SecondaryTargetingClass", 0), this);
            this.m_shopBuildingClass       = LogicDataTables.GetBuildingClassByName(this.GetValue("ShopBuildingClass", 0), this);

            if (this.m_shopBuildingClass == null)
            {
                this.m_shopBuildingClass = this.m_buildingClass;
            }

            this.m_exportNameNpc          = this.GetValue("ExportNameNpc", 0);
            this.m_exportNameConstruction = this.GetValue("ExportNameConstruction", 0);
            this.m_exportNameLocked       = this.GetValue("ExportNameLocked", 0);
            this.m_width               = this.GetIntegerValue("Width", 0);
            this.m_height              = this.GetIntegerValue("Height", 0);
            this.m_lootOnDestruction   = this.GetBooleanValue("LootOnDestruction", 0);
            this.m_bunker              = this.GetBooleanValue("Bunker", 0);
            this.m_village2Housing     = this.GetIntegerValue("Village2Housing", 0);
            this.m_upgradesUnits       = this.GetBooleanValue("UpgradesUnits", 0);
            this.m_producesUnitsOfType = this.GetIntegerValue("ProducesUnitsOfType", 0);
            this.m_freeBoost           = this.GetBooleanValue("FreeBoost", 0);
            this.m_randomHitPosition   = this.GetBooleanValue("RandomHitPosition", 0);
            this.m_chainAttackDistance = this.GetIntegerValue("ChainAttackDistance", 0);
            this.m_buildingW           = this.GetIntegerValue("BuildingW", 0);
            this.m_buildingH           = this.GetIntegerValue("BuildingH", 0);

            if (this.m_buildingW == 0)
            {
                this.m_buildingW = this.m_width;
            }

            if (this.m_buildingH == 0)
            {
                this.m_buildingH = this.m_height;
            }

            this.m_baseGfx                = this.GetIntegerValue("BaseGfx", 0);
            this.m_loadAmmoEffect         = LogicDataTables.GetEffectByName(this.GetValue("LoadAmmoEffect", 0), this);
            this.m_noAmmoEffect           = LogicDataTables.GetEffectByName(this.GetValue("NoAmmoEffect", 0), this);
            this.m_toggleAttackModeEffect = LogicDataTables.GetEffectByName(this.GetValue("ToggleAttackModeEffect", 0), this);
            this.m_pickUpEffect           = LogicDataTables.GetEffectByName(this.GetValue("PickUpEffect", 0), this);
            this.m_placingEffect          = LogicDataTables.GetEffectByName(this.GetValue("PlacingEffect", 0), this);
            this.m_canNotSellLast         = this.GetBooleanValue("CanNotSellLast", 0);
            this.m_locked            = this.GetBooleanValue("Locked", 0);
            this.m_startingHomeCount = this.GetIntegerValue("StartingHomeCount", 0);
            this.m_hidden            = this.GetBooleanValue("Hidden", 0);
            this.m_triggerRadius     = (this.GetIntegerValue("TriggerRadius", 0) << 9) / 100;
            this.m_appearEffect      = LogicDataTables.GetEffectByName(this.GetValue("AppearEffect", 0), this);
            this.m_forgesSpells      = this.GetBooleanValue("ForgesSpells", 0);
            this.m_forgesMiniSpells  = this.GetBooleanValue("ForgesMiniSpells", 0);
            this.m_isHeroBarrack     = this.GetBooleanValue("IsHeroBarrack", 0);
            this.m_aimRotateStep     = this.GetIntegerValue("AimRotateStep", 0);
            this.m_turnSpeed         = this.GetIntegerValue("TurnSpeed", 0);

            if (this.m_turnSpeed == 0)
            {
                this.m_turnSpeed = 500;
            }

            this.m_needsAim            = this.GetBooleanValue("NeedsAim", 0);
            this.m_exportNameBeamStart = this.GetValue("ExportNameBeamStart", 0);
            this.m_exportNameBeamEnd   = this.GetValue("ExportNameBeamEnd", 0);
            this.m_shareHeroCombatData = this.GetBooleanValue("ShareHeroCombatData", 0);
            this.m_dieDamageRadius     = (this.GetIntegerValue("DieDamageRadius", 0) << 9) / 100;
            this.m_dieDamageEffect     = LogicDataTables.GetEffectByName(this.GetValue("DieDamageEffect", 0), this);
            this.m_dieDamageDelay      = this.GetIntegerValue("DieDamageDelay", 0);

            if (this.m_dieDamageDelay > 4000)
            {
                Debugger.Warning("m_dieDamageDelay too big");
                this.m_dieDamageDelay = 4000;
            }

            this.m_isRed    = this.GetBooleanValue("IsRed", 0);
            this.m_redMul   = this.GetIntegerValue("RedMul", 0);
            this.m_greenMul = this.GetIntegerValue("GreenMul", 0);
            this.m_blueMul  = this.GetIntegerValue("BlueMul", 0);
            this.m_redAdd   = this.GetIntegerValue("RedAdd", 0);
            this.m_greenAdd = this.GetIntegerValue("GreenAdd", 0);
            this.m_blueAdd  = this.GetIntegerValue("BlueAdd", 0);

            this.m_selfAsAoeCenter        = this.GetBooleanValue("SelfAsAoeCenter", 0);
            this.m_newTargetAttackDelay   = this.GetIntegerValue("NewTargetAttackDelay", 0);
            this.m_gearUpLevelRequirement = this.GetIntegerValue("GearUpLevelRequirement", 0);
            this.m_bunker = this.GetBooleanValue("Bunker", 0);

            int longestArraySize = this.m_row.GetBiggestArraySize();

            this.m_buildResourceData              = new LogicResourceData[longestArraySize];
            this.m_altBuildResourceData           = new LogicResourceData[longestArraySize];
            this.m_storedResourceCounts           = new LogicArrayList <int> [longestArraySize];
            this.m_percentageStoredResourceCounts = new LogicArrayList <int> [longestArraySize];
            this.m_ammoResourceData       = new LogicResourceData[longestArraySize];
            this.m_attackItemData         = new LogicArrayList <LogicAttackerItemData>(longestArraySize);
            this.m_defenceTroopCharacter  = new LogicCharacterData[longestArraySize];
            this.m_defenceTroopCharacter2 = new LogicCharacterData[longestArraySize];

            this.m_buildCost             = new int[longestArraySize];
            this.m_ammoCost              = new int[longestArraySize];
            this.m_townHallLevel         = new int[longestArraySize];
            this.m_townHallVillage2Level = new int[longestArraySize];
            this.m_constructionTimes     = new int[longestArraySize];
            this.m_gearUpTime            = new int[longestArraySize];
            this.m_gearUpCost            = new int[longestArraySize];
            this.m_boostCost             = new int[longestArraySize];
            this.m_housingSpace          = new int[longestArraySize];
            this.m_housingSpaceAlt       = new int[longestArraySize];
            this.m_resourcePer100Hours   = new int[longestArraySize];
            this.m_resourceMax           = new int[longestArraySize];
            this.m_resourceIconLimit     = new int[longestArraySize];
            this.m_hitpoints             = new int[longestArraySize];
            this.m_regenTime             = new int[longestArraySize];
            this.m_amountCanBeUpgraded   = new int[longestArraySize];
            this.m_unitProduction        = new int[longestArraySize];
            this.m_strengthWeight        = new int[longestArraySize];
            this.m_destructionXP         = new int[longestArraySize];
            this.m_defenceTroopCount     = new int[longestArraySize];
            this.m_defenceTroopLevel     = new int[longestArraySize];
            this.m_dieDamage             = new int[longestArraySize];
            this.m_wallBlockX            = new int[0];
            this.m_wallBlockY            = new int[0];

            for (int i = 0; i < longestArraySize; i++)
            {
                LogicAttackerItemData itemData = new LogicAttackerItemData();
                itemData.CreateReferences(this.m_row, this, i);
                this.m_attackItemData.Add(itemData);

                this.m_dieDamage[i]                      = this.GetClampedIntegerValue("DieDamage", i);
                this.m_buildCost[i]                      = this.GetClampedIntegerValue("BuildCost", i);
                this.m_housingSpace[i]                   = this.GetClampedIntegerValue("HousingSpace", i);
                this.m_housingSpaceAlt[i]                = this.GetClampedIntegerValue("HousingSpaceAlt", i);
                this.m_unitProduction[i]                 = this.GetClampedIntegerValue("UnitProduction", i);
                this.m_gearUpCost[i]                     = this.GetClampedIntegerValue("GearUpCost", i);
                this.m_boostCost[i]                      = this.GetClampedIntegerValue("BoostCost", i);
                this.m_resourcePer100Hours[i]            = this.GetClampedIntegerValue("ResourcePer100Hours", i);
                this.m_resourceMax[i]                    = this.GetClampedIntegerValue("ResourceMax", i);
                this.m_resourceIconLimit[i]              = this.GetClampedIntegerValue("ResourceIconLimit", i);
                this.m_hitpoints[i]                      = this.GetClampedIntegerValue("Hitpoints", i);
                this.m_regenTime[i]                      = this.GetClampedIntegerValue("RegenTime", i);
                this.m_amountCanBeUpgraded[i]            = this.GetClampedIntegerValue("AmountCanBeUpgraded", i);
                this.m_buildResourceData[i]              = LogicDataTables.GetResourceByName(this.GetClampedValue("BuildResource", i), this);
                this.m_altBuildResourceData[i]           = LogicDataTables.GetResourceByName(this.GetClampedValue("AltBuildResource", i), this);
                this.m_townHallLevel[i]                  = LogicMath.Max(this.GetClampedIntegerValue("TownHallLevel", i) - 1, 0);
                this.m_townHallVillage2Level[i]          = LogicMath.Max(this.GetClampedIntegerValue("TownHallLevel2", i) - 1, 0);
                this.m_storedResourceCounts[i]           = new LogicArrayList <int>();
                this.m_percentageStoredResourceCounts[i] = new LogicArrayList <int>();

                LogicDataTable table = LogicDataTables.GetTable(LogicDataType.RESOURCE);

                for (int j = 0; j < table.GetItemCount(); j++)
                {
                    this.m_storedResourceCounts[i].Add(this.GetClampedIntegerValue("MaxStored" + table.GetItemAt(j).GetName(), i));
                    this.m_percentageStoredResourceCounts[i].Add(this.GetClampedIntegerValue("PercentageStored" + table.GetItemAt(j).GetName(), i));
                }

                this.m_gearUpTime[i]        = 60 * this.GetClampedIntegerValue("GearUpTime", i);
                this.m_constructionTimes[i] = 86400 * this.GetClampedIntegerValue("BuildTimeD", i) +
                                              3600 * this.GetClampedIntegerValue("BuildTimeH", i) +
                                              60 * this.GetClampedIntegerValue("BuildTimeM", i) +
                                              this.GetIntegerValue("BuildTimeS", i);
                this.m_destructionXP[i]    = this.GetClampedIntegerValue("DestructionXP", i);
                this.m_ammoResourceData[i] = LogicDataTables.GetResourceByName(this.GetClampedValue("AmmoResource", i), this);
                this.m_ammoCost[i]         = this.GetClampedIntegerValue("AmmoCost", i);
                this.m_strengthWeight[i]   = this.GetClampedIntegerValue("StrengthWeight", i);

                string defenceTroopCharacter = this.GetClampedValue("DefenceTroopCharacter", i);

                if (defenceTroopCharacter.Length > 0)
                {
                    this.m_defenceTroopCharacter[i] = LogicDataTables.GetCharacterByName(defenceTroopCharacter, this);
                }

                string defenceTroopCharacter2 = this.GetClampedValue("DefenceTroopCharacter2", i);

                if (defenceTroopCharacter2.Length > 0)
                {
                    this.m_defenceTroopCharacter2[i] = LogicDataTables.GetCharacterByName(defenceTroopCharacter2, this);
                }

                this.m_defenceTroopCount[i] = this.GetIntegerValue("DefenceTroopCount", i);
                this.m_defenceTroopLevel[i] = this.GetIntegerValue("DefenceTroopLevel", i);

                if (i > 0 && this.m_housingSpace[i] < this.m_housingSpace[i - 1])
                {
                    Debugger.Error("Building " + this.GetName() + " unit storage space decreases by upgrade level!");
                }
                if (this.m_gearUpCost[i] > 0 && this.m_gearUpTime[i] <= 0 || this.m_gearUpCost[i] <= 0 && this.m_gearUpTime[i] > 0)
                {
                    Debugger.Error("invalid gear up settings. gear up time and cost must be set for levels where available");
                }
            }

            this.m_areaOfEffectSpellData            = LogicDataTables.GetSpellByName(this.GetValue("AOESpell", 0), this);
            this.m_alternativeAreaOfEffectSpellData = LogicDataTables.GetSpellByName(this.GetValue("AOESpellAlternate", 0), this);
            this.m_produceResourceData = LogicDataTables.GetResourceByName(this.GetValue("ProducesResource", 0), this);
            this.m_gearUpResourceData  = LogicDataTables.GetResourceByName(this.GetValue("GearUpResource", 0), this);

            string heroType = this.GetValue("HeroType", 0);

            if (!string.IsNullOrEmpty(heroType))
            {
                this.m_heroData = LogicDataTables.GetHeroByName(heroType, this);
            }

            string wallBlockX = this.GetValue("WallBlockX", 0);

            if (wallBlockX.Length > 0)
            {
                this.LoadWallBlock(wallBlockX, out this.m_wallBlockX);
                this.LoadWallBlock(this.GetValue("WallBlockY", 0), out this.m_wallBlockY);

                if (this.m_wallBlockX.Length != this.m_wallBlockY.Length)
                {
                    Debugger.Error("LogicBuildingData: Error parsing wall offsets");
                }

                if (this.m_wallBlockX.Length > 10)
                {
                    Debugger.Error("LogicBuildingData: Too many wall blocks");
                }
            }

            string gearUpBuilding = this.GetValue("GearUpBuilding", 0);

            if (gearUpBuilding.Length > 0)
            {
                this.m_gearUpBuildingData = LogicDataTables.GetBuildingByName(gearUpBuilding, this);
            }

            this.m_isClockTower      = this.GetName().Equals("Clock Tower");
            this.m_isFlamer          = this.GetName().Equals("Flamer");
            this.m_isBarrackVillage2 = this.GetName().Equals("Barrack2");
        }