Exemplo n.º 1
0
nsTemplateCondition::nsTemplateCondition(nsIAtom* aSourceVariable,
                                         const nsAString& aRelation,
                                         const nsAString& aTargets,
                                         bool aIgnoreCase,
                                         bool aNegate,
                                         bool aIsMultiple)
    : mSourceVariable(aSourceVariable),
      mIgnoreCase(aIgnoreCase),
      mNegate(aNegate),
      mNext(nullptr)
{
    SetRelation(aRelation);

    if (aIsMultiple) {
        PRInt32 start = 0, end = 0;
        while ((end = aTargets.FindChar(',',start)) >= 0) {
            if (end > start) {
                mTargetList.AppendElement(Substring(aTargets, start, end - start));
            }
            start = end + 1;
        }
        if (start < PRInt32(aTargets.Length())) {
            mTargetList.AppendElement(Substring(aTargets, start));
        }
    }
    else {
        mTargetList.AppendElement(aTargets);
    }

    MOZ_COUNT_CTOR(nsTemplateCondition);
}
Exemplo n.º 2
0
nsTemplateCondition::nsTemplateCondition(const nsAString& aSource,
                                         const nsAString& aRelation,
                                         nsIAtom* aTargetVariable,
                                         bool aIgnoreCase,
                                         bool aNegate)
    : mSource(aSource),
      mTargetVariable(aTargetVariable),
      mIgnoreCase(aIgnoreCase),
      mNegate(aNegate),
      mNext(nullptr)
{
    SetRelation(aRelation);

    MOZ_COUNT_CTOR(nsTemplateCondition);
}
Exemplo n.º 3
0
void team::Hostility(team* Enemy)
{
  /* We're testing if the game works better this way... */

  if(ID != PLAYER_TEAM)
    return;

  if(this != Enemy && GetRelation(Enemy) != HOSTILE)
  {
    if(ID == PLAYER_TEAM && game::IsSumoWrestling())
      game::EndSumoWrestling(DISQUALIFIED);

    /* This is a gum solution. The behaviour should come from the script. */

    /*if(ID == COLONIST_TEAM && Enemy->ID == NEW_ATTNAM_TEAM)
      return;*/

    game::Hostility(this, Enemy);

    if(ID == PLAYER_TEAM)
    {
      if(Enemy->ID == ATTNAM_TEAM)
      {
				/* This is a gum solution. The message should come from the script. */
				if(PLAYER->CanHear())
					ADD_MESSAGE("You hear an alarm ringing.");

				if(game::GetStoryState() != 2)
				{
					v2 AngelPos = game::GetPetrus() ? game::GetPetrus()->GetPos() : v2(28, 20);
					int Seen = 0;
					angel* Angel;

					for(int c = 0; c < 3; ++c)
					{
						if(!c)
							Angel = archangel::Spawn(VALPURUS);
						else
							Angel = angel::Spawn(VALPURUS);

						v2 Where = game::GetCurrentLevel()->GetNearestFreeSquare(Angel, AngelPos);

						if(Where == ERROR_V2)
							Where = game::GetCurrentLevel()->GetRandomSquare(Angel);

						Angel->SetTeam(Enemy);
						Angel->PutTo(Where);

						if(Angel->CanBeSeenByPlayer())
							++Seen;
					}

					if(Seen == 1)
						ADD_MESSAGE("%s materializes.", Angel->CHAR_NAME(INDEFINITE));
					else if(Seen == 2)
						ADD_MESSAGE("Two %s materialize.", Angel->CHAR_NAME(PLURAL));
					else if(Seen == 3)
						ADD_MESSAGE("Three %s materialize.", Angel->CHAR_NAME(PLURAL));

					ADD_MESSAGE("\"We will defend the Holy Order!\"");
				}
      }

      ADD_MESSAGE("You have a feeling this wasn't a good idea...");
    }

    SetRelation(Enemy, HOSTILE);
  }
}