Tweaks.
@@ -90,39 +90,45 @@ | ||
90 | 90 | return; |
91 | 91 | } |
92 | 92 | Food.type foodType = null; |
93 | - int foodAmount = 1; | |
93 | + int foodNum = 1; | |
94 | + int foodAmount = -1; | |
94 | 95 | if (o.objType == Obj.Type.YUKKURI) { |
95 | 96 | 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; | |
122 | 99 | } |
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(); | |
123 | 125 | } |
124 | 126 | else if (o.objType == Obj.Type.FOOD) { |
125 | 127 | Food f = (Food)o; |
128 | + if (f.isEmpty()) { | |
129 | + return; | |
130 | + } | |
131 | + foodAmount = f.getAmount(); | |
126 | 132 | if (shitCount != 0) { |
127 | 133 | foodType = Food.type.BITTER; |
128 | 134 | shitCount = 0; |
@@ -181,8 +187,8 @@ | ||
181 | 187 | return; |
182 | 188 | } |
183 | 189 | |
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); | |
186 | 192 | } |
187 | 193 | Cash.delCash(getCost()); |
188 | 194 | return; |
@@ -29,7 +29,7 @@ | ||
29 | 29 | private boolean highDensity; |
30 | 30 | private boolean rapidGrowth; |
31 | 31 | 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}; | |
33 | 33 | private int type = 0; |
34 | 34 | private Random rnd = new Random(); |
35 | 35 |
@@ -63,8 +63,9 @@ | ||
63 | 63 | Body p = (Body) o; |
64 | 64 | if (!p.isDead() && ((int) age % ((highDensity == true) ? 4 : 10) == 0)) { |
65 | 65 | 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; | |
68 | 69 | } |
69 | 70 | else if ((p.getMutationType() != -1) && rnd.nextBoolean()) { |
70 | 71 | babyType = p.getMutationType(); |
@@ -743,13 +743,17 @@ | ||
743 | 743 | } |
744 | 744 | |
745 | 745 | 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); | |
747 | 747 | Cash.delCash(f.getPrice(Obj.Price.BUYING)); |
748 | 748 | foodList.add(f); |
749 | 749 | } |
750 | 750 | |
751 | 751 | 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); | |
753 | 757 | foodList.add(f); |
754 | 758 | } |
755 | 759 |
@@ -44,7 +44,7 @@ | ||
44 | 44 | |
45 | 45 | private static final int foodSize = 64; |
46 | 46 | |
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}; | |
48 | 48 | |
49 | 49 | private static Image[] images = new Image[NUM_OF_FOOD_STATE]; |
50 | 50 |
@@ -102,16 +102,16 @@ | ||
102 | 102 | if (priceType == Price.BUYING) { |
103 | 103 | return value[foodType.ordinal()]; |
104 | 104 | } |
105 | - return value[foodType.ordinal()] / 2; | |
105 | + return value[foodType.ordinal()] / 2 * amount / FOOD_AMOUNT; | |
106 | 106 | } |
107 | 107 | |
108 | - public Food(int initX, int initY, type initType) { | |
108 | + public Food(int initX, int initY, type initType, int initAmount) { | |
109 | 109 | objType = Type.FOOD; |
110 | 110 | x = initX; |
111 | 111 | y = initY; |
112 | 112 | z = 0; |
113 | 113 | foodType = initType; |
114 | - amount = FOOD_AMOUNT; | |
114 | + amount = (initAmount < 0 ? FOOD_AMOUNT : initAmount); | |
115 | 115 | removed = false; |
116 | 116 | } |
117 | 117 |
@@ -1605,6 +1605,11 @@ | ||
1605 | 1605 | } |
1606 | 1606 | return false; |
1607 | 1607 | } |
1608 | + | |
1609 | + public boolean isChildbearingAge() { | |
1610 | + int oldRatio = (int)(getAge() * 3 / getAgeLimit()); | |
1611 | + return (oldRatio == 0 ? true : rnd.nextInt(oldRatio) == 0); | |
1612 | + } | |
1608 | 1613 | |
1609 | 1614 | private int decideBabyType(Body p) { |
1610 | 1615 | int babyType; |
@@ -1626,7 +1631,7 @@ | ||
1626 | 1631 | } |
1627 | 1632 | } |
1628 | 1633 | 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) { | |
1630 | 1635 | babyType = idiotType; |
1631 | 1636 | } |
1632 | 1637 | return babyType; |