public static TyStateWeights UniformLerp(TyStateWeights lhs, TyStateWeights rhs, float t) { TyStateWeights p = new TyStateWeights(); for (int i = 0; i < p._weights.Length; i++) { p._weights[i] = TyUtility.Lerp(lhs._weights[i], rhs._weights[i], t); } return(p); }
public static TyStateWeights UniformRandLerp(TyStateWeights lhs, TyStateWeights rhs, System.Random random, float tMin, float tMax) { TyStateWeights p = new TyStateWeights(); for (int i = 0; i < p._weights.Length; i++) { float t = random.RandFloat(tMin, tMax); p._weights[i] = TyUtility.Lerp(lhs._weights[i], rhs._weights[i], t); } return(p); }
public static TyStateWeights NonUniformLerp(TyStateWeights lhs, TyStateWeights rhs, float[] tValues) { System.Diagnostics.Debug.Assert(tValues.Length >= (int)WeightType.Count); TyStateWeights p = new TyStateWeights(); for (int i = 0; i < p._weights.Length; i++) { p._weights[i] = TyUtility.Lerp(lhs._weights[i], rhs._weights[i], tValues[i]); } return(p); }
//When your hero takes fatal damage, prevent it and become Immune this turn. private static void IceBlock(TyState playerState, TyState opponentState, Controller player, Controller opponent, Spell secret) { //give punishment when at full hp, give reward if hp lessens const int MAX_HEALTH = 30; const int MIN_HEALTH = 1; float healthPercent = 1.0f - TyUtility.InverseLerp(playerState.HeroHealth, MIN_HEALTH, MAX_HEALTH); //punishment when at full hp: const float MIN_VALUE = -30.0f; //reward when at 1 hp: const float MAX_VALUE = 45.0f; float value = TyUtility.Lerp(MIN_VALUE, MAX_VALUE, healthPercent); playerState.BiasValue += value; }