Example #1
0
 internal void Activate(AdditionContext apply, Character character)
 {
     if (apply == AdditionContext.Applied)
     {
         Singleton.Additions.ApplyAddition(info.option_id, character);
     }
     else if (apply == AdditionContext.Deapplied)
     {
         Singleton.Additions.DeapplyAddition(info.option_id, character);
     }
     for (int i = 0; i < 2; i++)
     {
         Factory.Spells.Info    info1;
         Factory.Additions.Info info2;
         uint skill = Enchantments[i];
         if (skill > 0)
         {
             if (Singleton.SpellManager.TryGetSpell(skill, out info1) &&
                 Singleton.Additions.TryGetAddition(info1.addition, out info2))
             {
                 info2.Do(character, character, apply);
             }
         }
     }
 }
Example #2
0
    public AdditionContext addition()
    {
        AdditionContext _localctx = new AdditionContext(Context, State);

        EnterRule(_localctx, 4, RULE_addition);
        int _la;

        try {
            EnterOuterAlt(_localctx, 1);
            {
                State = 14; multiplication();
                State = 19;
                ErrorHandler.Sync(this);
                _la = TokenStream.LA(1);
                while (_la == PLUS || _la == MINUS)
                {
                    {
                        {
                            State = 15;
                            _la   = TokenStream.LA(1);
                            if (!(_la == PLUS || _la == MINUS))
                            {
                                ErrorHandler.RecoverInline(this);
                            }
                            else
                            {
                                ErrorHandler.ReportMatch(this);
                                Consume();
                            }
                            State = 16; multiplication();
                        }
                    }
                    State = 21;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                }
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
Example #3
0
 /// <summary>
 /// Applies the addition
 /// </summary>
 /// <param name="sender">Sender who calls the addition</param>
 /// <param name="target">Target of the sender</param>
 /// <param name="apply">Boolean indication to apply or deapply the addition</param>
 internal void Do(object sender, object target, AdditionContext apply)
 {
     try
     {
         AdditionValue state = new AdditionValue();
         state.context    = apply;
         state.sender     = sender;
         state.target     = target;
         state.additionid = this.Addition;
         del(ref state);
     }
     catch (Exception e)
     {
         Trace.TraceWarning("Critical error in addition: {0}", e.Message);
     }
 }
Example #4
0
 /// <summary>
 /// Actually applies the addition
 /// </summary>
 /// <param name="addition">Addition refetence</param>
 /// <param name="target">Target who to apply to</param>
 /// <param name="apply">Boolean indicating to apply or deapply</param>
 private void DoAddition(ref Info addition, Actor target, AdditionContext apply)
 {
     addition.Do(target, target, apply);
 }
Example #5
0
 internal void Activate(AdditionContext apply, Character character)
 {
     if (apply == AdditionContext.Applied)
         Singleton.Additions.ApplyAddition(info.option_id, character);
     else if (apply == AdditionContext.Deapplied)
         Singleton.Additions.DeapplyAddition(info.option_id, character);
     for (int i = 0; i < 2; i++)
     {
         Factory.Spells.Info info1;
         Factory.Additions.Info info2;
         uint skill = Enchantments[i];
         if (skill > 0)
         {
             if (Singleton.SpellManager.TryGetSpell(skill, out info1)
             && Singleton.Additions.TryGetAddition(info1.addition, out info2))
             {
                 info2.Do(character, character, apply);
             }
         }
     }
 }
 /// <summary>
 /// Applies the addition
 /// </summary>
 /// <param name="sender">Sender who calls the addition</param>
 /// <param name="target">Target of the sender</param>
 /// <param name="apply">Boolean indication to apply or deapply the addition</param>
 internal void Do(object sender, object target, AdditionContext apply)
 {
     try
     {
         AdditionValue state = new AdditionValue();
         state.context = apply;
         state.sender = sender;
         state.target = target;
         state.additionid = this.Addition;
         del(ref state);
     }
     catch (Exception e)
     {
         Trace.TraceWarning("Critical error in addition: {0}", e.Message);
     }
 }
 /// <summary>
 /// Actually applies the addition
 /// </summary>
 /// <param name="addition">Addition refetence</param>
 /// <param name="target">Target who to apply to</param>
 /// <param name="apply">Boolean indicating to apply or deapply</param>
 private void DoAddition(ref Info addition, Actor target, AdditionContext apply)
 {
     addition.Do(target, target, apply);
 }
Example #8
0
	private ExprContext expr(int _p) {
		ParserRuleContext _parentctx = Context;
		int _parentState = State;
		ExprContext _localctx = new ExprContext(Context, _parentState);
		ExprContext _prevctx = _localctx;
		int _startState = 4;
		EnterRecursionRule(_localctx, 4, RULE_expr, _p);
		int _la;
		try {
			int _alt;
			EnterOuterAlt(_localctx, 1);
			{
			State = 129;
			switch ( Interpreter.AdaptivePredict(TokenStream,12,Context) ) {
			case 1:
				{
				_localctx = new SignContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;

				State = 35;
				_la = TokenStream.La(1);
				if ( !(_la==T__14 || _la==T__15) ) {
				ErrorHandler.RecoverInline(this);
				}
				else {
				    Consume();
				}
				State = 36; expr(35);
				}
				break;
			case 2:
				{
				_localctx = new NegationContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 37; Match(T__25);
				State = 38; expr(29);
				}
				break;
			case 3:
				{
				_localctx = new FormulaeContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 39; Match(T__30);
				State = 40; expr(26);
				}
				break;
			case 4:
				{
				_localctx = new FunctionContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 41; Match(T__34);
				State = 42; Match(T__7);
				State = 44;
				_la = TokenStream.La(1);
				if (_la==T__53 || _la==ID) {
					{
					State = 43; formlist();
					}
				}

				State = 46; Match(T__8);
				State = 47; expr(23);
				}
				break;
			case 5:
				{
				_localctx = new RepeatStatementContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 48; Match(T__42);
				State = 52;
				ErrorHandler.Sync(this);
				_la = TokenStream.La(1);
				while (_la==NL) {
					{
					{
					State = 49; Match(NL);
					}
					}
					State = 54;
					ErrorHandler.Sync(this);
					_la = TokenStream.La(1);
				}
				State = 55; expr(17);
				}
				break;
			case 6:
				{
				_localctx = new HelpContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 56; Match(T__43);
				State = 57; expr(16);
				}
				break;
			case 7:
				{
				_localctx = new CompoundContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 58; Match(T__35);
				State = 60;
				_la = TokenStream.La(1);
				if (_la==NL) {
					{
					State = 59; Match(NL);
					}
				}

				State = 62; exprlist();
				State = 63; Match(T__36);
				}
				break;
			case 8:
				{
				_localctx = new IfStatementContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 65; Match(T__37);
				State = 66; Match(T__7);
				State = 67; expr(0);
				State = 68; Match(T__8);
				State = 70;
				_la = TokenStream.La(1);
				if (_la==NL) {
					{
					State = 69; Match(NL);
					}
				}

				State = 72; expr(0);
				}
				break;
			case 9:
				{
				_localctx = new IfElseStatementContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 74; Match(T__37);
				State = 75; Match(T__7);
				State = 76; expr(0);
				State = 77; Match(T__8);
				State = 79;
				_la = TokenStream.La(1);
				if (_la==NL) {
					{
					State = 78; Match(NL);
					}
				}

				State = 81; expr(0);
				State = 83;
				_la = TokenStream.La(1);
				if (_la==NL) {
					{
					State = 82; Match(NL);
					}
				}

				State = 85; Match(T__38);
				State = 87;
				_la = TokenStream.La(1);
				if (_la==NL) {
					{
					State = 86; Match(NL);
					}
				}

				State = 89; expr(0);
				}
				break;
			case 10:
				{
				_localctx = new ForEachStatementContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 91; Match(T__39);
				State = 92; Match(T__7);
				State = 93; Match(ID);
				State = 94; Match(T__40);
				State = 95; expr(0);
				State = 96; Match(T__8);
				State = 98;
				_la = TokenStream.La(1);
				if (_la==NL) {
					{
					State = 97; Match(NL);
					}
				}

				State = 100; expr(0);
				}
				break;
			case 11:
				{
				_localctx = new WhileStatementContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 102; Match(T__41);
				State = 103; Match(T__7);
				State = 104; expr(0);
				State = 105; Match(T__8);
				State = 107;
				_la = TokenStream.La(1);
				if (_la==NL) {
					{
					State = 106; Match(NL);
					}
				}

				State = 109; expr(0);
				}
				break;
			case 12:
				{
				_localctx = new NextStatementContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 111; Match(T__44);
				}
				break;
			case 13:
				{
				_localctx = new BreakStatementContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 112; Match(T__45);
				}
				break;
			case 14:
				{
				_localctx = new ParenthesizedContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 113; Match(T__7);
				State = 114; expr(0);
				State = 115; Match(T__8);
				}
				break;
			case 15:
				{
				_localctx = new IdentifierContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 117; Match(ID);
				}
				break;
			case 16:
				{
				_localctx = new StringLiteralContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 118; Match(STRING);
				}
				break;
			case 17:
				{
				_localctx = new HexLiteralContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 119; Match(HEX);
				}
				break;
			case 18:
				{
				_localctx = new IntLiteralContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 120; Match(INT);
				}
				break;
			case 19:
				{
				_localctx = new FloatLiteralContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 121; Match(FLOAT);
				}
				break;
			case 20:
				{
				_localctx = new ComplexLiteralContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 122; Match(COMPLEX);
				}
				break;
			case 21:
				{
				_localctx = new NullLiteralContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 123; Match(T__46);
				}
				break;
			case 22:
				{
				_localctx = new NAContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 124; Match(T__47);
				}
				break;
			case 23:
				{
				_localctx = new InfLiteralContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 125; Match(T__48);
				}
				break;
			case 24:
				{
				_localctx = new NanLiteralContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 126; Match(T__49);
				}
				break;
			case 25:
				{
				_localctx = new TrueLiteralContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 127; Match(T__50);
				}
				break;
			case 26:
				{
				_localctx = new FalseLiteralContext(_localctx);
				Context = _localctx;
				_prevctx = _localctx;
				State = 128; Match(T__51);
				}
				break;
			}
			Context.Stop = TokenStream.Lt(-1);
			State = 185;
			ErrorHandler.Sync(this);
			_alt = Interpreter.AdaptivePredict(TokenStream,14,Context);
			while ( _alt!=2 && _alt!=global::Antlr4.Runtime.Atn.ATN.InvalidAltNumber ) {
				if ( _alt==1 ) {
					if ( ParseListeners!=null )
						TriggerExitRuleEvent();
					_prevctx = _localctx;
					{
					State = 183;
					switch ( Interpreter.AdaptivePredict(TokenStream,13,Context) ) {
					case 1:
						{
						_localctx = new NamespaceContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 131;
						if (!(Precpred(Context, 38))) throw new FailedPredicateException(this, "Precpred(Context, 38)");
						State = 132;
						_la = TokenStream.La(1);
						if ( !(_la==T__9 || _la==T__10) ) {
						ErrorHandler.RecoverInline(this);
						}
						else {
						    Consume();
						}
						State = 133; expr(39);
						}
						break;
					case 2:
						{
						_localctx = new MemberAccessContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 134;
						if (!(Precpred(Context, 37))) throw new FailedPredicateException(this, "Precpred(Context, 37)");
						State = 135;
						_la = TokenStream.La(1);
						if ( !(_la==T__11 || _la==T__12) ) {
						ErrorHandler.RecoverInline(this);
						}
						else {
						    Consume();
						}
						State = 136; expr(38);
						}
						break;
					case 3:
						{
						_localctx = new PowerContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 137;
						if (!(Precpred(Context, 36))) throw new FailedPredicateException(this, "Precpred(Context, 36)");
						State = 138; Match(T__13);
						State = 139; expr(37);
						}
						break;
					case 4:
						{
						_localctx = new SequenceContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 140;
						if (!(Precpred(Context, 34))) throw new FailedPredicateException(this, "Precpred(Context, 34)");
						State = 141; Match(T__16);
						State = 142; expr(35);
						}
						break;
					case 5:
						{
						_localctx = new UserOpContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 143;
						if (!(Precpred(Context, 33))) throw new FailedPredicateException(this, "Precpred(Context, 33)");
						State = 144; Match(USER_OP);
						State = 145; expr(34);
						}
						break;
					case 6:
						{
						_localctx = new MultiplicationContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 146;
						if (!(Precpred(Context, 32))) throw new FailedPredicateException(this, "Precpred(Context, 32)");
						State = 147;
						_la = TokenStream.La(1);
						if ( !(_la==T__17 || _la==T__18) ) {
						ErrorHandler.RecoverInline(this);
						}
						else {
						    Consume();
						}
						State = 148; expr(33);
						}
						break;
					case 7:
						{
						_localctx = new AdditionContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 149;
						if (!(Precpred(Context, 31))) throw new FailedPredicateException(this, "Precpred(Context, 31)");
						State = 150;
						_la = TokenStream.La(1);
						if ( !(_la==T__14 || _la==T__15) ) {
						ErrorHandler.RecoverInline(this);
						}
						else {
						    Consume();
						}
						State = 151; expr(32);
						}
						break;
					case 8:
						{
						_localctx = new ComparisonContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 152;
						if (!(Precpred(Context, 30))) throw new FailedPredicateException(this, "Precpred(Context, 30)");
						State = 153;
						_la = TokenStream.La(1);
						if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__19) | (1L << T__20) | (1L << T__21) | (1L << T__22) | (1L << T__23) | (1L << T__24))) != 0)) ) {
						ErrorHandler.RecoverInline(this);
						}
						else {
						    Consume();
						}
						State = 154; expr(31);
						}
						break;
					case 9:
						{
						_localctx = new LogicalAndContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 155;
						if (!(Precpred(Context, 28))) throw new FailedPredicateException(this, "Precpred(Context, 28)");
						State = 156;
						_la = TokenStream.La(1);
						if ( !(_la==T__26 || _la==T__27) ) {
						ErrorHandler.RecoverInline(this);
						}
						else {
						    Consume();
						}
						State = 157; expr(29);
						}
						break;
					case 10:
						{
						_localctx = new LogicalOrContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 158;
						if (!(Precpred(Context, 27))) throw new FailedPredicateException(this, "Precpred(Context, 27)");
						State = 159;
						_la = TokenStream.La(1);
						if ( !(_la==T__28 || _la==T__29) ) {
						ErrorHandler.RecoverInline(this);
						}
						else {
						    Consume();
						}
						State = 160; expr(28);
						}
						break;
					case 11:
						{
						_localctx = new FormulaeContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 161;
						if (!(Precpred(Context, 25))) throw new FailedPredicateException(this, "Precpred(Context, 25)");
						State = 162; Match(T__30);
						State = 163; expr(26);
						}
						break;
					case 12:
						{
						_localctx = new RightAssignmentContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 164;
						if (!(Precpred(Context, 24))) throw new FailedPredicateException(this, "Precpred(Context, 24)");
						State = 165;
						_la = TokenStream.La(1);
						if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__31) | (1L << T__32) | (1L << T__33))) != 0)) ) {
						ErrorHandler.RecoverInline(this);
						}
						else {
						    Consume();
						}
						State = 166; expr(25);
						}
						break;
					case 13:
						{
						_localctx = new ListAccessContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 167;
						if (!(Precpred(Context, 41))) throw new FailedPredicateException(this, "Precpred(Context, 41)");
						State = 168; Match(T__4);
						State = 169; sublist();
						State = 170; Match(T__5);
						State = 171; Match(T__5);
						}
						break;
					case 14:
						{
						_localctx = new IndexContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 173;
						if (!(Precpred(Context, 40))) throw new FailedPredicateException(this, "Precpred(Context, 40)");
						State = 174; Match(T__6);
						State = 175; sublist();
						State = 176; Match(T__5);
						}
						break;
					case 15:
						{
						_localctx = new FunctionCallContext(new ExprContext(_parentctx, _parentState));
						PushNewRecursionContext(_localctx, _startState, RULE_expr);
						State = 178;
						if (!(Precpred(Context, 39))) throw new FailedPredicateException(this, "Precpred(Context, 39)");
						State = 179; Match(T__7);
						State = 180; sublist();
						State = 181; Match(T__8);
						}
						break;
					}
					} 
				}
				State = 187;
				ErrorHandler.Sync(this);
				_alt = Interpreter.AdaptivePredict(TokenStream,14,Context);
			}
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			ErrorHandler.ReportError(this, re);
			ErrorHandler.Recover(this, re);
		}
		finally {
			UnrollRecursionContexts(_parentctx);
		}
		return _localctx;
	}