public void testCreatureStatsDeserialization() { string statsString = "[10, 2, 5, 6.0]"; CreatureStats expected = new CreatureStats(10, 2, 5, 6); CreatureStats actual = CreatureStats.fromJSONObject(JSONObject.Create(statsString)); Assert.That(expected.Equals(actual)); }
public override bool Equals(Object o) { CreatureForm other = (CreatureForm)o; bool isEqual = true; isEqual &= creatureTypes.Count == other.creatureTypes.Count; foreach (CreatureType ct in creatureTypes) { isEqual &= other.creatureTypes.Contains(ct); } CreatureStats expectedStats = (new CreatureStats()).getStatsWithMods(statMods); CreatureStats actualStats = (new CreatureStats()).getStatsWithMods(other.statMods); isEqual &= expectedStats.Equals(actualStats); isEqual &= (formAbility == null && other.formAbility == null) || formAbility.Equals(other.formAbility); isEqual &= (revealAction == null && other.revealAction == null) || revealAction.Equals(other.revealAction); isEqual &= (signature == null && other.signature == null) || signature.Equals(other.signature); return(isEqual); }
public override bool Equals(Object o) { Creature other = (Creature)o; bool isEqual = true; isEqual &= creatureId == other.creatureId; isEqual &= (moveset == null && other.moveset == null) || moveset.SetEquals(other.moveset); isEqual &= (focalPoints == null && other.focalPoints == null) || focalPoints.Equals(other.focalPoints); isEqual &= (baseStats == null && other.baseStats == null) || baseStats.Equals(other.baseStats); isEqual &= (baseForm == null && other.baseForm == null) || baseForm.Equals(other.baseForm); isEqual &= (currentForm == null && other.currentForm == null) || currentForm.Equals(other.baseForm); isEqual &= (availableForms == null && other.availableForms == null) || availableForms.Count == other.availableForms.Count; if (!(availableForms == null && other.availableForms == null)) { foreach (CreatureForm cf in availableForms) { isEqual &= other.availableForms.Contains(cf); } } return(isEqual); }