public IValue GetState(Address address) { AddressStateMap states = _blocks.GetState(address); states.TryGetValue(address, out var value); return(value); }
public object GetState(Address address) { AddressStateMap states = _blocks.GetStates(new[] { address }); states.TryGetValue(address, out object value); return(value); }
public override AddressStateMap Execute(Address from, Address to, AddressStateMap states) { var result = new BattleResult(); if (states.TryGetValue(to, out object value)) { var previousResult = (BattleResult)value; result.UsedWeapons = previousResult.UsedWeapons; result.Targets = previousResult.Targets; } result.UsedWeapons.Add(Weapon); result.Targets.Add(Target); return((AddressStateMap)states.SetItem(to, result)); }
public override AddressStateMap Execute(IActionContext context) { var result = new BattleResult(); AddressStateMap previousStates = context.PreviousStates; Address to = context.To; if (previousStates.TryGetValue(to, out object value)) { var previousResult = (BattleResult)value; result.UsedWeapons = previousResult.UsedWeapons; result.Targets = previousResult.Targets; } result.UsedWeapons.Add(Weapon); result.Targets.Add(Target); return((AddressStateMap)previousStates.SetItem(to, result)); }