public static ContextActionDealDamage2 CreateNew(DamageEnergyType energy, ContextDiceValue damage, bool isAoE = false, bool halfIfSaved = false, bool IgnoreCritical = false) { // energy damage ContextActionDealDamage2 c = CreateInstance <ContextActionDealDamage2>(); c.DamageType = new DamageTypeDescription() { Type = Kingmaker.RuleSystem.Rules.Damage.DamageType.Energy, Energy = energy, Common = new DamageTypeDescription.CommomData(), Physical = new DamageTypeDescription.PhysicalData() }; c.Duration = new ContextDurationValue() { BonusValue = 0, Rate = DurationRate.Rounds, DiceCountValue = 0, DiceType = DiceType.Zero }; c.Value = damage; c.IsAoE = isAoE; c.HalfIfSaved = halfIfSaved; c.IgnoreCritical = IgnoreCritical; return(c); }
/// <summary>AbilityRankType is only relevant for ContextValueType.Rank</summary> public static ContextDiceValue CreateContextDiceValue(DiceType Dx, ContextValueType diceType = ContextValueType.Simple, AbilityRankType diceRank = AbilityRankType.Default, int diceValue = 0, ContextValueType bonusType = ContextValueType.Simple, AbilityRankType bonusRank = AbilityRankType.Default, int bonusValue = 0) { var result = new ContextDiceValue(); result.DiceType = Dx; result.DiceCountValue = new ContextValue(); result.DiceCountValue.ValueType = diceType; result.DiceCountValue.ValueRank = diceRank; result.DiceCountValue.Value = diceValue; result.BonusValue = new ContextValue(); result.BonusValue.ValueType = bonusType; result.BonusValue.ValueRank = bonusRank; result.BonusValue.Value = bonusValue; return(result); }
public static ContextActionDealDamage2 CreateNew(StatType abilityType, ContextDiceValue damage, bool drain = false, bool isAoE = false, bool halfIfSaved = false, bool IgnoreCritical = false) { // ability damage ContextActionDealDamage2 c = CreateInstance <ContextActionDealDamage2>(); c.M_Type = Type.AbilityDamage; Harmony12.AccessTools.Field(typeof(ContextActionDealDamage), "m_type").SetValue(c, 1); // ?? does this work? c.Duration = new ContextDurationValue() { BonusValue = 0, Rate = DurationRate.Rounds, DiceCountValue = 0, DiceType = DiceType.Zero }; c.AbilityType = abilityType; c.Value = damage; c.IsAoE = isAoE; c.HalfIfSaved = halfIfSaved; c.Drain = drain; c.IgnoreCritical = IgnoreCritical; return(c); }