• R/O
  • SSH
  • HTTPS

simyukkuri: 提交


Commit MetaInfo

修订版262 (tree)
时间2015-09-09 17:18:47
作者mimisuke

Log Message

Tweaks.

更改概述

差异

--- branches/test/FoodMaker.java (revision 261)
+++ branches/test/FoodMaker.java (revision 262)
@@ -90,39 +90,45 @@
9090 return;
9191 }
9292 Food.type foodType = null;
93- int foodAmount = 1;
93+ int foodNum = 1;
94+ int foodAmount = -1;
9495 if (o.objType == Obj.Type.YUKKURI) {
9596 Body b = (Body)o;
96- if (b.isCrashed() || b.isBaby()) {
97- if (shitCount != 0) {
98- foodType = Food.type.BITTER;
99- shitCount = 0;
100- }
101- else if (b.isRaper()) {
102- foodType = Food.type.VIYUGRA;
103- }
104- else if (b.isRude()) {
105- foodType = Food.type.BITTER;
106- }
107- else if (b.isSick()) {
108- foodType = Food.type.HOT;
109- }
110- else {
111- foodType = Food.type.YUKKURIFOOD;
112- }
113-
114- if (b.isAdult()) {
115- foodAmount *= 3;
116- }
117- else if (b.isChild()) {
118- foodAmount *= 2;
119- }
120- processReady = false;
121- b.remove();
97+ if (!b.isCrashed() && !b.isBaby()) {
98+ return;
12299 }
100+ if (shitCount != 0) {
101+ foodType = Food.type.BITTER;
102+ shitCount = 0;
103+ }
104+ else if (b.isSick()) {
105+ foodType = Food.type.HOT;
106+ }
107+ else if (b.isIdiot() || b.isRude()) {
108+ foodType = Food.type.BITTER;
109+ }
110+ else if (b.isRaper()) {
111+ foodType = Food.type.VIYUGRA;
112+ }
113+ else {
114+ foodType = Food.type.YUKKURIFOOD;
115+ }
116+
117+ if (b.isAdult()) {
118+ foodNum *= 3;
119+ }
120+ else if (b.isChild()) {
121+ foodNum *= 2;
122+ }
123+ processReady = false;
124+ b.remove();
123125 }
124126 else if (o.objType == Obj.Type.FOOD) {
125127 Food f = (Food)o;
128+ if (f.isEmpty()) {
129+ return;
130+ }
131+ foodAmount = f.getAmount();
126132 if (shitCount != 0) {
127133 foodType = Food.type.BITTER;
128134 shitCount = 0;
@@ -181,8 +187,8 @@
181187 return;
182188 }
183189
184- for (int i = 0; i < foodAmount; i++) {
185- SimYukkuri.mypane.terrarium.addFood(x + 52 + rnd.nextInt(10), y + rnd.nextInt(10), foodType);
190+ for (int i = 0; i < foodNum; i++) {
191+ SimYukkuri.mypane.terrarium.addFood(x + 52 + rnd.nextInt(10), y + rnd.nextInt(10), foodType, foodAmount);
186192 }
187193 Cash.delCash(getCost());
188194 return;
--- branches/test/BreedingPool.java (revision 261)
+++ branches/test/BreedingPool.java (revision 262)
@@ -29,7 +29,7 @@
2929 private boolean highDensity;
3030 private boolean rapidGrowth;
3131 private static int[] value = {1000, 4000, 4000, 10000};
32- private static int[] cost = {5, 10, 10, 20};
32+ private static int[] cost = {100, 200, 200, 350};
3333 private int type = 0;
3434 private Random rnd = new Random();
3535
@@ -63,8 +63,9 @@
6363 Body p = (Body) o;
6464 if (!p.isDead() && ((int) age % ((highDensity == true) ? 4 : 10) == 0)) {
6565 int babyType;
66- if (p.isSick() || p.isDamaged()) {
67- babyType = InitLoader.getIdiotType();
66+ int idiotType = InitLoader.getIdiotType();
67+ if ((p.isSick() || p.isDamaged() || !p.isChildbearingAge()) && idiotType != -1) {
68+ babyType = idiotType;
6869 }
6970 else if ((p.getMutationType() != -1) && rnd.nextBoolean()) {
7071 babyType = p.getMutationType();
--- branches/test/Terrarium.java (revision 261)
+++ branches/test/Terrarium.java (revision 262)
@@ -743,13 +743,17 @@
743743 }
744744
745745 public void buyFood(int x, int y, Food.type type) {
746- Food f = new Food(x, y, type);
746+ Food f = new Food(x, y, type, -1);
747747 Cash.delCash(f.getPrice(Obj.Price.BUYING));
748748 foodList.add(f);
749749 }
750750
751751 public void addFood(int x, int y, Food.type type) {
752- Food f = new Food(x, y, type);
752+ addFood(x, y, type, -1);
753+ }
754+
755+ public void addFood(int x, int y, Food.type type, int amount) {
756+ Food f = new Food(x, y, type, amount);
753757 foodList.add(f);
754758 }
755759
--- branches/test/Food.java (revision 261)
+++ branches/test/Food.java (revision 262)
@@ -44,7 +44,7 @@
4444
4545 private static final int foodSize = 64;
4646
47- private static final int value[] = {0, 250, 100, 1000, 500, 300, 500, 0, 800};
47+ private static final int value[] = {0, 250, 50, 1000, 500, 300, 500, 0, 800};
4848
4949 private static Image[] images = new Image[NUM_OF_FOOD_STATE];
5050
@@ -102,16 +102,16 @@
102102 if (priceType == Price.BUYING) {
103103 return value[foodType.ordinal()];
104104 }
105- return value[foodType.ordinal()] / 2;
105+ return value[foodType.ordinal()] / 2 * amount / FOOD_AMOUNT;
106106 }
107107
108- public Food(int initX, int initY, type initType) {
108+ public Food(int initX, int initY, type initType, int initAmount) {
109109 objType = Type.FOOD;
110110 x = initX;
111111 y = initY;
112112 z = 0;
113113 foodType = initType;
114- amount = FOOD_AMOUNT;
114+ amount = (initAmount < 0 ? FOOD_AMOUNT : initAmount);
115115 removed = false;
116116 }
117117
--- branches/test/Body.java (revision 261)
+++ branches/test/Body.java (revision 262)
@@ -1605,6 +1605,11 @@
16051605 }
16061606 return false;
16071607 }
1608+
1609+ public boolean isChildbearingAge() {
1610+ int oldRatio = (int)(getAge() * 3 / getAgeLimit());
1611+ return (oldRatio == 0 ? true : rnd.nextInt(oldRatio) == 0);
1612+ }
16081613
16091614 private int decideBabyType(Body p) {
16101615 int babyType;
@@ -1626,7 +1631,7 @@
16261631 }
16271632 }
16281633 int idiotType = InitLoader.getIdiotType();
1629- if (((isSick() || p.isSick()) || isDamaged() || p.isDamaged()) && idiotType != -1) {
1634+ if (((isSick() || p.isSick()) || isDamaged() || p.isDamaged() || !isChildbearingAge() || !p.isChildbearingAge()) && idiotType != -1) {
16301635 babyType = idiotType;
16311636 }
16321637 return babyType;
Show on old repository browser