using BigFloatNumerics; using System; using System.Numerics; using UnityEngine; #if UNITY_EDITOR using UnityEditor; #endif [CreateAssetMenu(fileName = "HuntEagleDgProp", menuName = "ScriptableObject/GameMod/HuntEagleDgProp")] public class HuntEagleDgProp : GameModProperty { [Serializable] public struct GoodsCreator { public ItemProp itemProp; public float startCount; public float multiplierPerLevel; public float adderPerLevel; public BigInteger GetCount(uint level) { return Formula.Calculate(startCount, multiplierPerLevel, adderPerLevel, level); } } [Serializable] public struct LevelRangeReward { public Range lvRange; public GoodsCreator[] defaultRewards; public GoodsCreator[] initialClearRewards; } [Serializable] public struct EnemyCreator { [Serializable] struct StatProperty { public float baseV; public float multiplierPerLevel; public float adderPerLevel; } public CharacterProperty property; [SerializeField] StatProperty hpStat; public BigFloat GetHp(uint level) { return Formula.Calculate(hpStat.baseV, hpStat.multiplierPerLevel, hpStat.adderPerLevel, level); } } public static string CodeName => "HuntEagleDg"; public override string codeName => CodeName; public string bgmPath; public string backGroundPath; public uint openStage = 1; public EnemyCreator normalEnemyCreator; public float limitTime = 1; public LevelRangeReward[] rewards; public ItemProp enterCostItem; public override GameModData CreateData(GameModPlayProperty playProperty) { Debug.Assert(playProperty is HuntEagleDgPlayProp, "Invalid play property type."); return new HuntEagleDgData(this, playProperty as HuntEagleDgPlayProp); } #if UNITY_EDITOR [ContextMenu("Create")] private void Create() { const int max = 56; rewards = new LevelRangeReward[max]; var petCookie = AssetDatabase.LoadAssetAtPath($"Assets/Resources/ScriptableObject/Item/Currency/ItemProp_PetCookie.asset"); for (int i = 0; i < max; i++) { var lvRR = new LevelRangeReward(); uint div = (uint)(i / 2); var targetPetCard = AssetDatabase.LoadAssetAtPath($"Assets/Resources/ScriptableObject/Item/PetCard/ItemProp_PetCard_{div + 1}.asset"); lvRR.defaultRewards = new GoodsCreator[2]; lvRR.defaultRewards[0] = new GoodsCreator { itemProp = petCookie, startCount = 100, multiplierPerLevel = 1.005f, adderPerLevel = 100 }; lvRR.defaultRewards[1] = new GoodsCreator { itemProp = targetPetCard, startCount = 1, multiplierPerLevel = 1, adderPerLevel = 0 }; if((i + 1) % 2 == 0) { uint rng = 10 * (div + 1); lvRR.lvRange = new Range(rng, rng); var targetPet = AssetDatabase.LoadAssetAtPath($"Assets/Resources/ScriptableObject/Item/Pet/ItemProp_Pet_{div + 1}.asset"); lvRR.initialClearRewards = new GoodsCreator[1]; lvRR.initialClearRewards[0] = new GoodsCreator { itemProp = targetPet, startCount = 1, multiplierPerLevel = 1, adderPerLevel = 0 }; } else { uint start = 1 + 10 * div; uint end = 10 * (div + 1) - 1; lvRR.lvRange = new Range(start, end); } rewards[i] = lvRR; } } #endif }