Ejemplo n.º 1
0
    //Reactions (behaviours with an action parameter)
    void BasicReactions(Being b)
    {
        //Create a new reaction called 'self preservation'
        Reaction selfPreservation = new Reaction(actionManager, b, "Self Preservation", ThoughtType.Reaction);
        AmTarget_ReactionCondition       amtarget    = new AmTarget_ReactionCondition(actionManager, b, "Am target");
        ContainsEffect_ReactionCondition dealsDamage = new ContainsEffect_ReactionCondition(actionManager, b, "Deals Damage", "Damage");
        IncludesEffect_SelectionCriteria dodges      = new IncludesEffect_SelectionCriteria(actionManager, b, "dodges", "Dodge");
        IncludesEffect_SelectionCriteria blocks      = new IncludesEffect_SelectionCriteria(actionManager, b, "blocks", "Block");
        Self_TargetingCriteria           targetSelf  = new Self_TargetingCriteria(actionManager, b);


        selfPreservation.reactionConditions.Add(amtarget);
        selfPreservation.reactionConditions.Add(dealsDamage);
        selfPreservation.selectionCriteria.Add(dodges);
        selfPreservation.selectionCriteria.Add(blocks);
        selfPreservation.targetingCriteria.Add(targetSelf);

        b.reactions.Add(selfPreservation);

        //create a reaction called 'notice danger'
        Reaction noticeDanger = new Reaction(actionManager, b, "Notice Danger", ThoughtType.Reaction);
        ContainsEffect_ReactionCondition dealsDamage2 = new ContainsEffect_ReactionCondition(actionManager, b, "Deals Damage", "Damage");
        IncludesEffect_SelectionCriteria exclamation  = new IncludesEffect_SelectionCriteria(actionManager, b, "Exclamation", "Exclamation");
        Self_TargetingCriteria           targetSelf2  = new Self_TargetingCriteria(actionManager, b);

        noticeDanger.reactionConditions.Add(dealsDamage2);
        noticeDanger.selectionCriteria.Add(exclamation);
        noticeDanger.targetingCriteria.Add(targetSelf2);

        b.reactions.Add(noticeDanger);
    }
Ejemplo n.º 2
0
    public void DefendTeamReaction(Being b, int team)
    {
        //Create a new reaction called 'self preservation'
        Reaction defendTeam = new Reaction(actionManager, b, "Defend Team", ThoughtType.Reaction);
        NoCondition_Condition                noCondition        = new NoCondition_Condition(actionManager, b, "No Condition");
        TargetOnTeam_ReactionCondition       targetOnTeam       = new TargetOnTeam_ReactionCondition(actionManager, b, "target on team", team);
        ContainsEffect_ReactionCondition     dealsDamage        = new ContainsEffect_ReactionCondition(actionManager, b, "Deals Damage", "Damage");
        IncludesEffect_SelectionCriteria     blocks             = new IncludesEffect_SelectionCriteria(actionManager, b, "blocks", "Block");
        CurrentActionActor_TargetingCriteria currentActionActor = new CurrentActionActor_TargetingCriteria(actionManager, b);

        defendTeam.conditions.Add(noCondition);
        defendTeam.reactionConditions.Add(targetOnTeam);
        defendTeam.reactionConditions.Add(dealsDamage);
        defendTeam.selectionCriteria.Add(blocks);
        defendTeam.targetingCriteria.Add(currentActionActor);

        b.reactions.Add(defendTeam);
    }