You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

137 lines
3.9 KiB

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<uint> 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<ItemProp>($"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<ItemProp>($"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<uint>(rng, rng);
var targetPet = AssetDatabase.LoadAssetAtPath<ItemProp>($"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<uint>(start, end);
}
rewards[i] = lvRR;
}
}
#endif
}