private bool cantripLevelSelected(CastSpellCommand command) { ValidableResponse <GetInputCantripLevelResponse> response = base._mediator.Value.Execute(new GetInputCantripLevelCommand()) as ValidableResponse <GetInputCantripLevelResponse>; if (response.IsValid) { command.CastLevel = response.Response.Level; } return(response.IsValid); }
private bool normalSpellLevelSelected(CastSpellCommand command) { ValidableResponse <GetInputSpellLevelResponse> response = base._mediator.Value.Execute(new GetInputNormalSpellLevelCommand(command.Spell.BaseLevel)) as ValidableResponse <GetInputSpellLevelResponse>; if (response.IsValid) { command.CastLevel = response.Response.Level; } return(response.IsValid); }
private bool targetsSelected(CastSpellCommand command) { GetInputSpellTargetsCommand target_command = new GetInputSpellTargetsCommand(command.Spell.AmountTargets, command.Spell.CanSelectSameTargetTwice); if (command.CastLevel != command.Spell.BaseLevel && command.Spell.AdditionalTargetPerLevel != 0) { target_command.AmountTargets += command.Spell.AdditionalTargetPerLevel * (command.CastLevel - command.Spell.BaseLevel); } ValidableResponse <GetInputSpellTargetsResponse> response = base._mediator.Value.Execute(target_command) as ValidableResponse <GetInputSpellTargetsResponse>; if (response.IsValid) { command.TargetNames = response.Response.TargetNames; } return(response.IsValid); }
private bool castAttackSpell(CastSpellCommand command) { NewAttackSpellResult template = command.Spell.GetAttackSpellResultTemplate(fighterProvider.Value.GetFighterByDisplayName(command.CasterName), command.CastLevel); List <NewAttackSpellResult> spellResults = new List <NewAttackSpellResult>(); foreach (string name in command.TargetNames) { NewAttackSpellResult spellResult = template.Clone() as NewAttackSpellResult; spellResult.Target = fighterProvider.Value.GetFighterByDisplayName(name); spellResults.Add(spellResult); } GetInputAttackSpellResultsCommand _command = new GetInputAttackSpellResultsCommand(command.Spell.DisplayName, command.CastLevel, spellResults); ValidableResponse <GetInputAttackSpellResultsResponse> response = base._mediator.Value.Execute(_command) as ValidableResponse <GetInputAttackSpellResultsResponse>; if (response.IsValid) { ;// actually execute the spell } return(response.IsValid); }