protected override SpellLevel GetLevelTemplate(int level) { LevelTemplate = new SpellLevel(); // We only take effects with a duration or damage or healing effect into considération. Others are probably constant effects on the caster when holding the weapon. LevelTemplate.effects = _weapon.possibleEffects.OfType<EffectInstanceDice>().Where(effect => (effect.duration != 0) || ((GetEffectCategories(effect.effectId, 0) & (SpellCategory.Damages | SpellCategory.Healing)) > 0)).ToList(); foreach (var effect in LevelTemplate.effects) effect.rawZone = _weapon.type.rawZone; LevelTemplate.criticalEffect = LevelTemplate.effects; Level = 1; LevelTemplate.minRange = (uint)_weapon.minRange; LevelTemplate.range = (uint)_weapon.range; LevelTemplate.apCost = (uint)_weapon.apCost; LevelTemplate.castInDiagonal = _weapon.castInDiagonal; LevelTemplate.castInLine = _weapon.castInLine; LevelTemplate.castTestLos = _weapon.castTestLos; LevelTemplate.criticalHitProbability = (uint)_weapon.criticalHitProbability; LevelTemplate.criticalFailureProbability = (uint)_weapon.criticalFailureProbability; return LevelTemplate; }
public bool IsInSpellRange(Cell cell, SpellLevel spell) { var range = GetRealSpellRange(spell); var dist = Cell.DistanceTo(cell); return dist >= spell.minRange && dist <= range; }
private bool IsInLineIfNeeded(Cell cell, SpellLevel spell) { if (!spell.castInLine) return true; return Cell.X == cell.X || Cell.Y == cell.Y; }
public int GetRealSpellRange(SpellLevel spell) { var range = (int) (spell.rangeCanBeBoosted ? Stats.Range + spell.range : spell.range); if (range < spell.minRange) return (int) spell.minRange; return range; }
public bool IsInSpellRange(Cell cell, SpellLevel spell) { var range = GetRealSpellRange(spell); var dist = Cell.ManhattanDistanceTo(cell); if (!(dist >= spell.minRange && dist <= range)) return false; return IsInLineIfNeeded(cell, spell); }