Esempio n. 1
0
 public ClanPosition addPosition() {
   Authority[] pows = new Authority[Function.values().length];
   for (int i = 0; i < pows.length; i++) pows[i] = Authority.CAN_NOT_DO;
   Set<Integer> roles = new HashSet<Integer>();
   int highestRank = 0;
   for (ClanPosition pos : positions) {
     roles.add(Integer.valueOf(pos.getRoleID()));
     if (highestRank < pos.getRank()) highestRank = pos.getRank();
   }
   if (positions.length > 0)
     for (int i = 0; i < pows.length; i++) pows[i] = positions[0].getFunctionChart()[i];
   positions = Arrays.copyOf(positions, positions.length + 1);
   ClanPosition P = (ClanPosition) CMClass.getCommon("DefaultClanPosition");
   P.setID(positions.length + "" + Math.random());
   P.setRoleID(0);
   P.setRank(highestRank);
   P.setName("Unnamed");
   P.setPluralName("Unnameds");
   P.setMax(Integer.MAX_VALUE);
   P.setInnerMaskStr("");
   P.setFunctionChart(pows);
   P.setPublic(true);
   positions[positions.length - 1] = P;
   for (int i = 0; i < positions.length; i++)
     if (!roles.contains(Integer.valueOf(i))) {
       P.setRoleID(i);
       break;
     }
   return P;
 }
Esempio n. 2
0
/*


   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

	   http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public class Desert extends StdRoom {
  public String ID() {
    return "Desert";
  }

  public Desert() {
    super();
    name = "the desert";
    basePhyStats.setWeight(2);
    recoverPhyStats();
  }

  public int domainType() {
    return Room.DOMAIN_OUTDOORS_DESERT;
  }

  public int domainConditions() {
    return Room.CONDITION_HOT;
  }

  protected int baseThirst() {
    return 4;
  }

  public static final Integer[] resourceList = {
    Integer.valueOf(RawMaterial.RESOURCE_CACTUS),
    Integer.valueOf(RawMaterial.RESOURCE_SAND),
    Integer.valueOf(RawMaterial.RESOURCE_LAMPOIL),
    Integer.valueOf(RawMaterial.RESOURCE_PEPPERS),
    Integer.valueOf(RawMaterial.RESOURCE_SCALES),
    Integer.valueOf(RawMaterial.RESOURCE_DATES)
  };
  public static final Vector roomResources = new Vector(Arrays.asList(resourceList));

  public List<Integer> resourceChoices() {
    return Desert.roomResources;
  }
}