internal static HitpointsAtLevel Parse(IniParser parser) { return(new HitpointsAtLevel { Hitpoints = parser.ParseAttributeInteger("Hitpoints"), Level = parser.ParseAttributeInteger("Level") }); }
internal static MappedImageCoords Parse(IniParser parser) { return(new MappedImageCoords { Left = parser.ParseAttributeInteger("Left"), Top = parser.ParseAttributeInteger("Top"), Right = parser.ParseAttributeInteger("Right"), Bottom = parser.ParseAttributeInteger("Bottom") }); }
internal static RangeDuration Parse(IniParser parser) { var token = parser.GetNextToken(IniParser.SeparatorsColon); if (parser.IsFloat(token)) { var value = parser.ScanFloat(token); return(new RangeDuration { Min = value, Max = value }); } if (token.Text.ToUpper() != "MIN") { throw new IniParseException($"Unexpected range duration: {token.Text}", token.Position); } var minValue = parser.ScanInteger(parser.GetNextToken()); return(new RangeDuration { Min = minValue, Max = parser.ParseAttributeInteger("Max") }); }
internal static LevelBonus Parse(IniParser parser) { return(new LevelBonus { Level = parser.ParseAttributeInteger("Level"), Bonus = parser.ParseAttributeFloat("Bonus") }); }
internal static DamagePerRound Parse(IniParser parser) { return(new DamagePerRound { Damage = parser.ParseAttributeInteger("Damage"), Against = parser.ParseAttributeIdentifier("Against") }); }
internal static RangeDuration Parse(IniParser parser) { if (parser.CurrentTokenType == IniTokenType.IntegerLiteral || parser.CurrentTokenType == IniTokenType.FloatLiteral) { var value = parser.ParseFloat(); return(new RangeDuration { Min = value, Max = value }); } return(new RangeDuration { Min = parser.ParseAttributeInteger("Min"), Max = parser.ParseAttributeInteger("Max") }); }
internal static TargetPriority Parse(IniParser parser) { return(new TargetPriority { Target = parser.ParseAttributeIdentifier("Target"), Priority = parser.ParseAttributeInteger("Priority") }); }
internal static ModifierUpgrade Parse(IniParser parser) { return(new ModifierUpgrade { Upgrade = parser.ParseAssetReference(), Delay = parser.ParseAttributeInteger("Delay") }); }
internal static ModifierUpgrade Parse(IniParser parser) { var upgrades = new List <string>(); var token = parser.PeekNextTokenOptional(); while (token.HasValue && !token.Value.Text.Contains(":")) { upgrades.Add(parser.ParseAssetReference()); token = parser.PeekNextTokenOptional(); } return(new ModifierUpgrade { Upgrades = upgrades.ToArray(), Delay = parser.ParseAttributeInteger("Delay") }); }
private void ParseTransition(IniParser parser, Action <BridgeTransition> callback) { var transitionType = parser.ParseAttributeEnum <BridgeTransitionType>("Transition"); var toState = parser.ParseAttributeEnum <BodyDamageType>("ToState"); var effectNum = parser.ParseAttributeInteger("EffectNum"); var transition = Transitions.FirstOrDefault(x => x.Transition == transitionType && x.ToState == toState && x.EffectNum == effectNum); if (transition == null) { Transitions.Add(transition = new BridgeTransition(transitionType, toState, effectNum)); } callback(transition); }