Exemplo n.º 1
0
void GameOver::DialogWins(u16 cond)
{
    const Settings & conf = Settings::Get();
    std::string body;

    switch(cond)
    {
	case WINS_ALL:
	    break;

	case WINS_TOWN:
	{
	    body = _("You captured %{name}!\nYou are victorious.");
	    const Castle* town = world.GetCastle(conf.WinsMapsIndexObject());
	    if(town) String::Replace(body, "%{name}", town->GetName());
	}
	break;

	case WINS_HERO:
	{
	    body = _("You have captured the enemy hero %{name}!\nYour quest is complete.");
	    const Heroes* hero = world.GetHeroesCondWins();
	    if(hero) String::Replace(body, "%{name}", hero->GetName());
	    break;
	}

	case WINS_ARTIFACT:
	{
	    body = _("You have found the %{name}.\nYour quest is complete.");
	    if(conf.WinsFindUltimateArtifact())
		String::Replace(body, "%{name}", "Ultimate Artifact");
	    else
	    {
		const Artifact art = conf.WinsFindArtifactID();
		String::Replace(body, "%{name}", art.GetName());
	    }
	    break;
        }

        case WINS_SIDE:
    	    body = _("The enemy is beaten.\nYour side has triumphed!");
    	    break;

        case WINS_GOLD:
        {
    	    body = _("You have built up over %{count} gold in your treasury.\nAll enemies bow before your wealth and power.");
	    String::Replace(body, "%{count}", conf.WinsAccumulateGold());
    	    break;
	}

    	default: break;
    }

    AGG::PlayMusic(MUS::VICTORY, false);

    if(body.size()) Dialog::Message("", body, Font::BIG, Dialog::OK);
}
Exemplo n.º 2
0
std::string GameOver::GetActualDescription(u16 cond)
{
    const Settings & conf = Settings::Get();
    std::string msg;

    if(WINS_ALL == cond || WINS_SIDE == cond)
	msg = GetString(WINS_ALL);
    else
    if(WINS_TOWN & cond)
    {
	const Castle* town = world.GetCastle(conf.WinsMapsIndexObject());
	if(town)
	{
    	    msg = town->isCastle() ? _("Capture the castle '%{name}'") : _("Capture the town '%{name}'");;
	    String::Replace(msg, "%{name}", town->GetName());
	}
    }
    else
    if(WINS_HERO & cond)
    {
	const Heroes* hero = world.GetHeroesCondWins();
	if(hero)
	{
	    msg = _("Defeat the hero '%{name}'");
	    String::Replace(msg, "%{name}", hero->GetName());
	}
    }
    else
    if(WINS_ARTIFACT & cond)
    {
	if(conf.WinsFindUltimateArtifact())
	    msg = _("Find the ultimate artifact");
	else
	{
	    const Artifact art = conf.WinsFindArtifactID();
	    msg = _("Find the '%{name}' artifact");
	    String::Replace(msg, "%{name}", art.GetName());
	}
    }
    else
    if(WINS_GOLD & cond)
    {
	msg = _("Accumulate %{count} gold");
	String::Replace(msg, "%{count}", conf.WinsAccumulateGold());
    }

    if(WINS_ALL != cond && (WINS_ALL & cond)) msg.append(_(", or you may win by defeating all enemy heroes and capturing all enemy towns and castles."));

    if(LOSS_ALL == cond)
	msg = GetString(WINS_ALL);
    else
    if(LOSS_TOWN & cond)
    {
	const Castle* town = world.GetCastle(conf.LossMapsIndexObject());
	if(town)
	{
    	    msg = town->isCastle() ? _("Lose the castle '%{name}'.") : _("Lose the town '%{name}'.");
	    String::Replace(msg, "%{name}", town->GetName());
	}
    }
    else
    if(LOSS_HERO & cond)
    {
    	const Heroes* hero = world.GetHeroesCondLoss();
	if(hero)
	{
	    msg = _("Lose the hero: %{name}.");
	    String::Replace(msg, "%{name}", hero->GetName());
	}
    }
    else
    if(LOSS_TIME & cond)
    {
	msg = _("Fail to win by the end of month %{month}, week %{week}, day %{day}.");
        String::Replace(msg, "%{day}", (conf.LossCountDays() % DAYOFWEEK));
        String::Replace(msg, "%{week}", (conf.LossCountDays() / DAYOFWEEK) + 1);
        String::Replace(msg, "%{month}", (conf.LossCountDays() / (DAYOFWEEK * WEEKOFMONTH)) + 1);
    }

    if(conf.ExtWorldStartHeroLossCond4Humans())
    {
	const std::string names = world.GetKingdom(conf.CurrentColor()).GetNamesHeroStartCondLoss();
        std::string str = std::string::npos == names.find(',') ? _("Lose the hero: %{name}.") : _("Lose the heroes: %{name}.");
        String::Replace(str, "%{name}", names);
	msg.append("\n");
	msg.append(str);
    }

    return msg;
}
Exemplo n.º 3
0
void GameOver::DialogLoss(u16 cond)
{
    const Settings & conf = Settings::Get();
    std::string body;

    switch(cond)
    {
	case WINS_ARTIFACT:
	{
	    body = _("The enemy has found the %{name}.\nYour quest is a failure.");
	    const Artifact art = conf.WinsFindArtifactID();
	    String::Replace(body, "%{name}", art.GetName());
	    break;
        }

        case WINS_SIDE:
        {
    	    body = _("%{color} has fallen!\nAll is lost.");
	    String::Replace(body, "%{color}", Color::String(conf.CurrentColor()));
    	    break;
    	}

        case WINS_GOLD:
        {
    	    body = _("The enemy has built up over %{count} gold in his treasury.\nYou must bow done in defeat before his wealth and power.");
	    String::Replace(body, "%{count}", conf.WinsAccumulateGold());
    	    break;
	}

	case LOSS_ALL:
	    body = _("You have been eliminated from the game!!!");
	    break;

	case LOSS_TOWN:
	{
	    body = _("The enemy has captured %{name}!\nThey are triumphant.");
	    const Castle* town = world.GetCastle(conf.WinsMapsIndexObject());
	    if(town) String::Replace(body, "%{name}", town->GetName());
	}

	case LOSS_STARTHERO:
	{
	    const Heroes* hero = world.GetKingdom(conf.CurrentColor()).GetFirstHeroStartCondLoss();
	    body = _("You have lost the hero %{name}.\nYour quest is over.");
	    if(hero) String::Replace(body, "%{name}", hero->GetName());
	    break;
	}

	case LOSS_HERO:
	{
	    body = _("You have lost the hero %{name}.\nYour quest is over.");
	    const Heroes* hero = world.GetHeroesCondLoss();
	    if(hero) String::Replace(body, "%{name}", hero->GetName());
	    break;
	}

	case LOSS_TIME:
	    body = _("You have failed to complete your quest in time.\nAll is lost.");
	    break;

    	default: break;
    }

    AGG::PlayMusic(MUS::LOSTGAME, false);

    if(body.size()) Dialog::Message("", body, Font::BIG, Dialog::OK);
}