Esempio n. 1
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!");
                }
            }
        }
Esempio n. 2
0
 public static bool IsSkeleton(LogicCharacterData data)
 {
     return(data == LogicDataTables.m_skeletonData || data == LogicDataTables.m_balloonSkeletonData);
 }
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_villageType     = this.GetIntegerValue("UIGroup", 0);
            this.m_diamondReward   = this.GetIntegerValue("DiamondReward", 0);
            this.m_expReward       = this.GetIntegerValue("ExpReward", 0);
            this.m_actionCount     = this.GetIntegerValue("ActionCount", 0);
            this.m_actionDataLevel = this.GetIntegerValue("ActionDataLevel", 0);
            this.m_level           = this.GetIntegerValue("Level", 0);
            this.m_levelCount      = this.GetIntegerValue("LevelCount", 0);
            this.m_uiPriority      = this.GetIntegerValue("UIPriority", 0);

            this.m_completedTID = this.GetValue("CompletedTID", 0);
            this.m_showValue    = this.GetBooleanValue("ShowValue", 0);
            this.m_androidId    = this.GetValue("AndroidID", 0);

            if (this.m_actionCount == 0)
            {
                Debugger.Error("Achievement has invalid ActionCount 0");
            }

            string action = this.GetValue("Action", 0);

            switch (action)
            {
            case "npc_stars":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_NPC_STARS;
                break;

            case "upgrade":
                this.m_actionType   = LogicAchievementData.ACTION_TYPE_UPGRADE;
                this.m_buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0), this);

                if (this.m_buildingData == null)
                {
                    Debugger.Error("LogicAchievementData - Building data is NULL for upgrade achievement");
                }

                break;

            case "victory_points":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_VICTORY_POINTS;
                break;

            case "unit_unlock":
                this.m_actionType    = LogicAchievementData.ACTION_TYPE_UNIT_UNLOCK;
                this.m_characterData = LogicDataTables.GetCharacterByName(this.GetValue("ActionData", 0), this);

                if (this.m_characterData == null)
                {
                    Debugger.Error("LogicCharacterData - Character data is NULL for unit_unlock achievement");
                }

                break;

            case "clear_obstacles":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_CLEAR_OBSTACLES;
                break;

            case "donate_units":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_DONATE_UNITS;
                break;

            case "loot":
                this.m_actionType   = LogicAchievementData.ACTION_TYPE_LOOT;
                this.m_resourceData = LogicDataTables.GetResourceByName(this.GetValue("ActionData", 0), this);

                if (this.m_resourceData == null)
                {
                    Debugger.Error("LogicAchievementData - Resource data is NULL for loot achievement");
                }

                break;

            case "destroy":
                this.m_actionType   = LogicAchievementData.ACTION_TYPE_DESTROY;
                this.m_buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0), this);

                if (this.m_buildingData == null)
                {
                    Debugger.Error("LogicAchievementData - Building data is NULL for destroy achievement");
                }

                break;

            case "win_pvp_attack":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_WIN_PVP_ATTACK;
                break;

            case "win_pvp_defense":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_WIN_PVP_DEFENSE;
                break;

            case "league":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_LEAGUE;
                break;

            case "war_stars":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_WAR_STARS;
                break;

            case "war_loot":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_WAR_LOOT;
                break;

            case "donate_spells":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_DONATE_SPELLS;
                break;

            case "account_bound":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_ACCOUNT_BOUND;
                break;

            case "vs_battle_trophies":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_VERSUS_BATTLE_TROPHIES;
                break;

            case "gear_up":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_GEAR_UP;
                break;

            case "repair_building":
                this.m_actionType   = LogicAchievementData.ACTION_TYPE_REPAIR_BUILDING;
                this.m_buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0), this);

                if (this.m_buildingData == null)
                {
                    Debugger.Error("LogicAchievementData - Building data is NULL for repair_building achievement");
                }

                break;

            case "clan_games_points":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_CLAN_GAMES_POINTS;
                break;

            case "dragon_slayer":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_DRAGON_SLAYER;
                break;

            case "league_war_stars":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_LEAGUE_WAR_STARS;
                break;

            case "scid_bound":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_SUPERCELLID_BOUND;
                break;

            case "season_challenge_points":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_SEASON_CHALLENGE_POINTS;
                break;

            case "activate_super_licence":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_ACTIVATE_SUPER_LICENCE;
                break;

            case "donate_sieges":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_DONATE_SIEGES;
                break;

            default:
                Debugger.Error(string.Format("Unknown Action in achievements {0}", action));
                break;
            }

            this.m_achievementLevel = new LogicArrayList <LogicAchievementData>();

            string         achievementName = this.GetName().Substring(0, this.GetName().Length - 1);
            LogicDataTable table           = LogicDataTables.GetTable(LogicDataType.ACHIEVEMENT);

            for (int i = 0; i < table.GetItemCount(); i++)
            {
                LogicAchievementData achievementData = (LogicAchievementData)table.GetItemAt(i);

                if (achievementData.GetName().Contains(achievementName))
                {
                    if (achievementData.GetName().Substring(0, achievementData.GetName().Length - 1).Equals(achievementName))
                    {
                        this.m_achievementLevel.Add(achievementData);
                    }
                }
            }

            Debugger.DoAssert(this.m_achievementLevel.Size() == this.m_levelCount, string.Format(
                                  "Expected same amount of achievements named {0}X to be same as LevelCount={1} for {2}.",
                                  achievementName,
                                  this.m_levelCount,
                                  this.GetName()));
        }
Esempio n. 4
0
        public LogicData CreateItem(CSVRow row)
        {
            LogicData data = null;

            switch (this.m_tableIndex)
            {
            case LogicDataType.BUILDING:
            {
                data = new LogicBuildingData(row, this);
                break;
            }

            case LogicDataType.LOCALE:
            {
                data = new LogicLocaleData(row, this);
                break;
            }

            case LogicDataType.RESOURCE:
            {
                data = new LogicResourceData(row, this);
                break;
            }

            case LogicDataType.CHARACTER:
            {
                data = new LogicCharacterData(row, this);
                break;
            }

            case LogicDataType.ANIMATION:
            {
                data = new LogicAnimationData(row, this);
                break;
            }

            case LogicDataType.PROJECTILE:
            {
                data = new LogicProjectileData(row, this);
                break;
            }

            case LogicDataType.BUILDING_CLASS:
            {
                data = new LogicBuildingClassData(row, this);
                break;
            }

            case LogicDataType.OBSTACLE:
            {
                data = new LogicObstacleData(row, this);
                break;
            }

            case LogicDataType.EFFECT:
            {
                data = new LogicEffectData(row, this);
                break;
            }

            case LogicDataType.PARTICLE_EMITTER:
            {
                data = new LogicParticleEmitterData(row, this);
                break;
            }

            case LogicDataType.EXPERIENCE_LEVEL:
            {
                data = new LogicExperienceLevelData(row, this);
                break;
            }

            case LogicDataType.TRAP:
            {
                data = new LogicTrapData(row, this);
                break;
            }

            case LogicDataType.ALLIANCE_BADGE:
            {
                data = new LogicAllianceBadgeData(row, this);
                break;
            }

            case LogicDataType.GLOBAL:
            case LogicDataType.CLIENT_GLOBAL:
            {
                data = new LogicGlobalData(row, this);
                break;
            }

            case LogicDataType.TOWNHALL_LEVEL:
            {
                data = new LogicTownhallLevelData(row, this);
                break;
            }

            case LogicDataType.ALLIANCE_PORTAL:
            {
                data = new LogicAlliancePortalData(row, this);
                break;
            }

            case LogicDataType.NPC:
            {
                data = new LogicNpcData(row, this);
                break;
            }

            case LogicDataType.DECO:
            {
                data = new LogicDecoData(row, this);
                break;
            }

            case LogicDataType.RESOURCE_PACK:
            {
                data = new LogicResourcePackData(row, this);
                break;
            }

            case LogicDataType.SHIELD:
            {
                data = new LogicShieldData(row, this);
                break;
            }

            case LogicDataType.MISSION:
            {
                data = new LogicMissionData(row, this);
                break;
            }

            case LogicDataType.BILLING_PACKAGE:
            {
                data = new LogicBillingPackageData(row, this);
                break;
            }

            case LogicDataType.ACHIEVEMENT:
            {
                data = new LogicAchievementData(row, this);
                break;
            }

            case LogicDataType.SPELL:
            {
                data = new LogicSpellData(row, this);
                break;
            }

            case LogicDataType.HINT:
            {
                data = new LogicHintData(row, this);
                break;
            }

            case LogicDataType.HERO:
            {
                data = new LogicHeroData(row, this);
                break;
            }

            case LogicDataType.LEAGUE:
            {
                data = new LogicLeagueData(row, this);
                break;
            }

            case LogicDataType.NEWS:
            {
                data = new LogicNewsData(row, this);
                break;
            }

            case LogicDataType.WAR:
            {
                data = new LogicWarData(row, this);
                break;
            }

            case LogicDataType.REGION:
            {
                data = new LogicRegionData(row, this);
                break;
            }

            case LogicDataType.ALLIANCE_BADGE_LAYER:
            {
                data = new LogicAllianceBadgeLayerData(row, this);
                break;
            }

            case LogicDataType.ALLIANCE_LEVEL:
            {
                data = new LogicAllianceLevelData(row, this);
                break;
            }

            case LogicDataType.HELPSHIFT:
            {
                data = new LogicHelpshiftData(row, this);
                break;
            }

            case LogicDataType.CREDIT:
            case LogicDataType.FAQ:
            case LogicDataType.VARIABLE:
            {
                data = new LogicData(row, this);
                break;
            }

            case LogicDataType.GEM_BUNDLE:
            {
                data = new LogicGemBundleData(row, this);
                break;
            }

            case LogicDataType.VILLAGE_OBJECT:
            {
                data = new LogicVillageObjectData(row, this);
                break;
            }

            case LogicDataType.CALENDAR_EVENT_FUNCTION:
            {
                data = new LogicCalendarEventFunctionData(row, this);
                break;
            }

            case LogicDataType.BOOMBOX:
            {
                data = new LogicBoomboxData(row, this);
                break;
            }

            case LogicDataType.EVENT_ENTRY:
            {
                data = new LogicEventEntryData(row, this);
                break;
            }

            case LogicDataType.DEEPLINK:
            {
                data = new LogicDeeplinkData(row, this);
                break;
            }

            case LogicDataType.LEAGUE_VILLAGE2:
            {
                data = new LogicLeagueVillage2Data(row, this);
                break;
            }

            default:
            {
                Debugger.Error("Invalid data table id: " + this.m_tableIndex);
                break;
            }
            }

            return(data);
        }
Esempio n. 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);
        }
        public override void CreateReferences()
        {
            base.CreateReferences();

            for (int i = 0; i < this.GetArraySize("Dependencies"); i++)
            {
                LogicMissionData dependency = LogicDataTables.GetMissionByName(this.GetValue("Dependencies", i), this);

                if (dependency != null)
                {
                    this.m_missionDependencies.Add(dependency);
                }
            }

            this.m_action               = this.GetValue("Action", 0);
            this.m_deprecated           = this.GetBooleanValue("Deprecated", 0);
            this.m_missionCategory      = this.GetIntegerValue("MissionCategory", 0);
            this.m_fixVillageObjectData = LogicDataTables.GetVillageObjectByName(this.GetValue("FixVillageObject", 0), this);

            if (this.m_fixVillageObjectData != null)
            {
                this.m_buildBuildingLevel = this.GetIntegerValue("BuildBuildingLevel", 0);
                this.m_missionType        = 13;
            }

            if (string.Equals(this.m_action, "travel"))
            {
                this.m_missionType = 14;
            }
            else if (string.Equals(this.m_action, "upgrade2"))
            {
                this.m_characterData = LogicDataTables.GetCharacterByName(this.GetValue("Character", 0), this);
                this.m_missionType   = 17;
            }
            else if (string.Equals(this.m_action, "duel"))
            {
                this.m_attackNpcData = LogicDataTables.GetNpcByName(this.GetValue("AttackNPC", 0), this);
                this.m_missionType   = 18;
            }
            else if (string.Equals(this.m_action, "duel_end"))
            {
                this.m_attackNpcData = LogicDataTables.GetNpcByName(this.GetValue("AttackNPC", 0), this);
                this.m_missionType   = 19;
            }
            else if (string.Equals(this.m_action, "duel_end2"))
            {
                this.m_missionType = 20;
            }
            else if (string.Equals(this.m_action, "show_builder_menu"))
            {
                this.m_missionType = 21;
            }

            this.m_buildBuildingData = LogicDataTables.GetBuildingByName(this.GetValue("BuildBuilding", 0), this);

            if (this.m_buildBuildingData != null)
            {
                this.m_buildBuildingCount = this.GetIntegerValue("BuildBuildingCount", 0);
                this.m_buildBuildingLevel = this.GetIntegerValue("BuildBuildingLevel", 0) - 1;
                this.m_missionType        = string.Equals(this.m_action, "unlock") ? 15 : 5;

                if (this.m_buildBuildingCount < 0)
                {
                    Debugger.Error("missions.csv: BuildBuildingCount is invalid!");
                }
            }
            else
            {
                if (this.m_missionType == -1)
                {
                    this.m_openAchievements = this.GetBooleanValue("OpenAchievements", 0);

                    if (this.m_openAchievements)
                    {
                        this.m_missionType = 7;
                    }
                    else
                    {
                        this.m_defendNpcData = LogicDataTables.GetNpcByName(this.GetValue("DefendNPC", 0), this);

                        if (this.m_defendNpcData != null)
                        {
                            this.m_missionType = 1;
                        }
                        else
                        {
                            this.m_attackNpcData = LogicDataTables.GetNpcByName(this.GetValue("AttackNPC", 0), this);

                            if (this.m_attackNpcData != null)
                            {
                                this.m_missionType = 2;
                                this.m_showMap     = this.GetBooleanValue("ShowMap", 0);
                            }
                            else
                            {
                                this.m_changeName = this.GetBooleanValue("ChangeName", 0);

                                if (this.m_changeName)
                                {
                                    this.m_missionType = 6;
                                }
                                else
                                {
                                    this.m_trainTroopCount = this.GetIntegerValue("TrainTroops", 0);

                                    if (this.m_trainTroopCount > 0)
                                    {
                                        this.m_missionType = 4;
                                    }
                                    else
                                    {
                                        this.m_switchSides = this.GetBooleanValue("SwitchSides", 0);

                                        if (this.m_switchSides)
                                        {
                                            this.m_missionType = 8;
                                        }
                                        else
                                        {
                                            this.m_showWarBase = this.GetBooleanValue("ShowWarBase", 0);

                                            if (this.m_showWarBase)
                                            {
                                                this.m_missionType = 9;
                                            }
                                            else
                                            {
                                                this.m_openInfo = this.GetBooleanValue("OpenInfo", 0);

                                                if (this.m_openInfo)
                                                {
                                                    this.m_missionType = 11;
                                                }
                                                else
                                                {
                                                    this.m_showDonate = this.GetBooleanValue("ShowDonate", 0);

                                                    if (this.m_showDonate)
                                                    {
                                                        this.m_missionType = 10;
                                                    }
                                                    else
                                                    {
                                                        this.m_showStates = this.GetBooleanValue("WarStates", 0);

                                                        if (this.m_showStates)
                                                        {
                                                            this.m_missionType = 12;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            this.m_villagers = this.GetIntegerValue("Villagers", 0);

            if (this.m_villagers > 0)
            {
                this.m_missionType = 16;
            }

            this.m_forceCamera = this.GetBooleanValue("ForceCamera", 0);

            if (this.m_missionType == -1)
            {
                Debugger.Error(string.Format("missions.csv: invalid mission ({0})", this.GetName()));
            }

            this.m_rewardResourceData  = LogicDataTables.GetResourceByName(this.GetValue("RewardResource", 0), this);
            this.m_rewardResourceCount = this.GetIntegerValue("RewardResourceCount", 0);

            if (this.m_rewardResourceData != null)
            {
                if (this.m_rewardResourceCount != 0)
                {
                    if (this.m_rewardResourceCount < 0)
                    {
                        Debugger.Error("missions.csv: RewardResourceCount is negative!");

                        this.m_rewardResourceData  = null;
                        this.m_rewardResourceCount = 0;
                    }
                }
                else
                {
                    this.m_rewardResourceData = null;
                }
            }
            else if (this.m_rewardResourceCount != 0)
            {
                Debugger.Warning("missions.csv: RewardResourceCount defined but RewardResource is not!");
                this.m_rewardResourceCount = 0;
            }

            this.m_customData = this.GetIntegerValue("CustomData", 0);
            this.m_rewardXp   = this.GetIntegerValue("RewardXP", 0);

            if (this.m_rewardXp < 0)
            {
                Debugger.Warning("missions.csv: RewardXP is negative!");
                this.m_rewardXp = 0;
            }

            this.m_rewardCharacterData  = LogicDataTables.GetCharacterByName(this.GetValue("RewardTroop", 0), this);
            this.m_rewardCharacterCount = this.GetIntegerValue("RewardTroopCount", 0);

            if (this.m_rewardCharacterData != null)
            {
                if (this.m_rewardCharacterCount != 0)
                {
                    if (this.m_rewardCharacterCount < 0)
                    {
                        Debugger.Error("missions.csv: RewardTroopCount is negative!");

                        this.m_rewardCharacterData  = null;
                        this.m_rewardCharacterCount = 0;
                    }
                }
                else
                {
                    this.m_rewardCharacterData = null;
                }
            }
            else if (this.m_rewardCharacterCount != 0)
            {
                Debugger.Warning("missions.csv: RewardTroopCount defined but RewardTroop is not!");
                this.m_rewardCharacterCount = 0;
            }

            this.m_delay        = this.GetIntegerValue("Delay", 0);
            this.m_villageType  = this.GetIntegerValue("VillageType", 0);
            this.m_firstStep    = this.GetBooleanValue("FirstStep", 0);
            this.m_tutorialText = this.GetValue("TutorialText", 0);

            if (this.m_tutorialText.Length > 0)
            {
                // BLABLABLA
            }
        }
Esempio n. 7
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);
            }
        }