Exemplo n.º 1
0
// Create properties for use with components.  This function is based off the
// function of the same name implemented in RFTS.
void taeRuleset::createProperties() {
    Property* prop = new Property();
    DesignStore* ds = Game::getGame()->getDesignStore();

    // Passengers
    prop = new Property();
    prop->addCategoryId(ds->getCategoryByName("Ships"));
    prop->setRank(0);
    prop->setName("Passengers");
    prop->setDisplayName("Passengers");
    prop->setDescription("The passengers aboard the ship");
    // Value of property -> String to display:
    // 1 -> Merchants
    // 2 -> Scientists
    // 3 -> Settlers
    // 4 -> Mining Robots
    // 5 -> Merchant Leader
    // 6 -> Lead Scientist
    // 7 -> Government Official
    // 8 -> Mining Foreman
    prop->setTpclDisplayFunction("(lambda (design bits) (let ((n (apply + bits)))"
        "(cons n (cond "
            "((= n 1) \"Merchants\") "
            "((= n 2) \"Scientists\") "
            "((= n 3) \"Settlers\") "
            "((= n 4) \"Mining Robots\") "
            "((= n 5) \"Merchant Leader\") "
            "((= n 6) \"Lead Scientist\") "
            "((= n 7) \"Government Official\") "
            "((= n 8) \"Mining Foreman\") "
            "((< n 1) (cons n \"ERROR: value too low!\")) "
            "((> n 8) (cons n \"ERROR: value too high!\"))))))");
    prop->setTpclRequirementsFunction("(lambda (design) (cons #t \"\"))");
    ds->addProperty(prop);

    prop = new Property();
    prop->addCategoryId(ds->getCategoryByName("Ships"));
    prop->setRank(0);
    prop->setName("Bombs");
    prop->setDisplayName("Supernova Bombs");
    prop->setDescription("The number of supernova bombs aboard the ship");
    prop->setTpclDisplayFunction("(lambda (design bits) (let ((n (apply + bits))) (cons n (string-append (number->string n) \" bombs\")) ) )");
    prop->setTpclRequirementsFunction("(lambda (design) (cons #t \"\"))");
    ds->addProperty(prop);

}
void PropertyFactory::initWeaponWinProperty() {
  Property* prop = new Property();
  DesignStore *ds = Game::getGame()->getDesignStore();

  prop->setCategoryId(ds->getCategoryByName("Ships"));
  prop->setRank(0);
  prop->setName("WeaponWin");
  prop->setDisplayName("Weapon Strength at Win");
  prop->setDescription("The amount of damage done on a win.");
  prop->setTpclDisplayFunction("(lambda (design bits) (let ((n (apply + bits))) (cons n (string-append (number->string n) \" HP\")) ) )");
  prop->setTpclRequirementsFunction("(lambda (design) (cons #t \"\"))");
  ds->addProperty(prop);
  return;
}
void PropertyFactory::initSpeedProperty() {
  Property* prop = new Property();
  DesignStore *ds = Game::getGame()->getDesignStore();

  prop->setCategoryId(ds->getCategoryByName("Ships"));
  prop->setRank(0);
  prop->setName("Speed");
  prop->setDisplayName("Speed");
  prop->setDescription("How fast a ship moves. ");
  prop->setTpclDisplayFunction("(lambda (design bits) (let ((n (apply + bits))) (cons n (string-append (number->string (/ n 1000000)) \" mega-units\")) ) )");
  prop->setTpclRequirementsFunction("(lambda (design) (cons #t \"\"))");
  ds->addProperty(prop);
  return;
}
void PropertyFactory::initColoniseProperty() {
  Property* prop = new Property();
  DesignStore *ds = Game::getGame()->getDesignStore();

  prop->setCategoryId(ds->getCategoryByName("Ships"));
  prop->setRank(0);
  prop->setName("Colonise");
  prop->setDisplayName("Colonise");
  prop->setDescription("Whether a ship can colonise or not.");
  prop->setTpclDisplayFunction("(lambda (design bits) (let ((n (apply + bits))) (cons n (if (= n 1) \"Yes\" \"No\")) ) )");
  prop->setTpclRequirementsFunction("(lambda (design) (cons #t \"\"))");
  ds->addProperty(prop);
  return;
}
void PropertyFactory::initBuildTimeProperty() {
  Property* prop = new Property();
  DesignStore *ds = Game::getGame()->getDesignStore();

  prop->setCategoryId(ds->getCategoryByName("Ships"));
  prop->setRank(0);
  prop->setName("BuildTime");
  prop->setDisplayName("Build Time");
  prop->setDescription("The number of turns to build a ship");
  prop->setTpclDisplayFunction("(lambda (design bits) (let ((n (apply + bits))) (cons n (string-append (number->string n) \" turns\")) ) )");
  prop->setTpclRequirementsFunction("(lambda (design) (cons #t \"\"))");
  ds->addProperty(prop);
  return;
}
void PropertyFactory::init_num_componentsProperty() {
  Property* prop = new Property();
  DesignStore *ds = Game::getGame()->getDesignStore();

  prop->setCategoryId(ds->getCategoryByName("Ships"));
  prop->setRank(0);
  prop->setName("_num-components");
  prop->setDisplayName("Number of Components");
  prop->setDescription("The number of components in a design");
  prop->setTpclDisplayFunction("(lambda (design bits) (let ((n (apply + bits))) (cons n (string-append (number->string n) \" components\"))))");
  prop->setTpclRequirementsFunction("(lambda (design) (cons #t \"\"))");
  ds->addProperty(prop);
  return;
}
Exemplo n.º 7
0
void taeRuleset::createComponents() {
    DesignStore *ds = Game::getGame()->getDesignStore();

    Component* comp = new Component();
    map<unsigned int, string> propList;

    //Merchants
    comp->addCategoryId(ds->getCategoryByName("Ships"));
    comp->setName("MerchantCargo");
    comp->setDescription("A cargo hold outfitted to carry businessmen");
    comp->setTpclRequirementsFunction(
        "(lambda (design) "
            "(if (= (designType._num-components design) 1) "
            "(cons #t \"\") "
            "(cons #f \"This is a complete component, nothing else can be included\")))");
    propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 1)";
    comp->setPropertyList(propList);
    ds->addComponent(comp);

    //Scientists
    comp = new Component();
    comp->addCategoryId(ds->getCategoryByName("Ships"));
    comp->setName("ScientistCargo");
    comp->setDescription("A cargo hold outfitted to carry scientists");
    comp->setTpclRequirementsFunction(
        "(lambda (design) "
            "(if (= (designType._num-components design) 1) "
            "(cons #t \"\") "
            "(cons #f \"This is a complete component, nothing else can be included\")))");
    propList.clear();
    propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 2)";
    comp->setPropertyList(propList);
    ds->addComponent(comp);

    //Settlers
    comp = new Component();
    comp->addCategoryId(ds->getCategoryByName("Ships"));
    comp->setName("SettlerCargo");
    comp->setDescription("A cargo hold outfitted to carry settlers");
    comp->setTpclRequirementsFunction(
        "(lambda (design) "
            "(if (= (designType._num-components design) 1) "
            "(cons #t \"\") "
            "(cons #f \"This is a complete component, nothing else can be included\")))");
    propList.clear();
    propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 3)";
    comp->setPropertyList(propList);
    ds->addComponent(comp);

    //Mining Robots
    comp = new Component();
    comp->addCategoryId(ds->getCategoryByName("Ships"));
    comp->setName("MiningCargo");
    comp->setDescription("A cargo hold outfitted to carry mining robots");
    comp->setTpclRequirementsFunction(
        "(lambda (design) "
            "(if (= (designType._num-components design) 1) "
            "(cons #t \"\") "
            "(cons #f \"This is a complete component, nothing else can be included\")))");
    propList.clear();
    propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 4)";
    comp->setPropertyList(propList);
    ds->addComponent(comp);

    //Merchant Leader
    comp = new Component();
    comp->addCategoryId(ds->getCategoryByName("Ships"));
    comp->setName("MerchantLeaderCargo");
    comp->setDescription("A cargo hold outfitted to carry powerful business leaders");
    comp->setTpclRequirementsFunction(
        "(lambda (design) "
            "(if (= (designType._num-components design) 1) "
            "(cons #t \"\") "
            "(cons #f \"This is a complete component, nothing else can be included\")))");
    propList.clear();
    propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 5)";
    comp->setPropertyList(propList);
    ds->addComponent(comp);

    //Lead Scientist
    comp = new Component();
    comp->addCategoryId(ds->getCategoryByName("Ships"));
    comp->setName("ScientistLeaderCargo");
    comp->setDescription("A cargo hold outfitted to carry a lead scientist");
    comp->setTpclRequirementsFunction(
        "(lambda (design) "
            "(if (= (designType._num-components design) 1) "
            "(cons #t \"\") "
            "(cons #f \"This is a complete component, nothing else can be included\")))");
    propList.clear();
    propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 6)";
    comp->setPropertyList(propList);
    ds->addComponent(comp);

    //Government Official
    comp = new Component();
    comp->addCategoryId(ds->getCategoryByName("Ships"));
    comp->setName("SettlerLeaderCargo");
    comp->setDescription("A cargo hold outfitted to a government leader");
    comp->setTpclRequirementsFunction(
        "(lambda (design) "
            "(if (= (designType._num-components design) 1) "
            "(cons #t \"\") "
            "(cons #f \"This is a complete component, nothing else can be included\")))");
    propList.clear();
    propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 7)";
    comp->setPropertyList(propList);
    ds->addComponent(comp);

    //Mining Foreman
    comp = new Component();
    comp->addCategoryId(ds->getCategoryByName("Ships"));
    comp->setName("MiningLeaderCargo");
    comp->setDescription("A cargo hold outfitted to a highly specialized mining robot leader");
    comp->setTpclRequirementsFunction(
        "(lambda (design) "
            "(if (= (designType._num-components design) 1) "
            "(cons #t \"\") "
            "(cons #f \"This is a complete component, nothing else can be included\")))");
    propList.clear();
    propList[ds->getPropertyByName("Passengers")] = "(lambda (design) 8)";
    comp->setPropertyList(propList);
    ds->addComponent(comp);

    //Weapons Arsenal
    comp = new Component();
    comp->addCategoryId(ds->getCategoryByName("Ships"));
    comp->setName("Weapon");
    comp->setDescription("The weapons arsenal for the ship");
    comp->setTpclRequirementsFunction(
        "(lambda (design) "
            "(if (= (designType._num-components design) 1) "
            "(cons #t \"\") "
            "(cons #f \"This is a complete component, nothing else can be included\")))");
    propList.clear();
    propList[ds->getPropertyByName("Bombs")] = "(lambda (design) 1)";
    comp->setPropertyList(propList);
    ds->addComponent(comp);

}