• R/O
  • SSH
  • HTTPS

simyukkuri: 提交


Commit MetaInfo

修订版230 (tree)
时间2013-09-08 22:43:16
作者mimisuke

Log Message

Applied the patches related to #32009.

更改概述

差异

--- branches/cantreadcode/Toilet.java (revision 229)
+++ branches/cantreadcode/Toilet.java (revision 230)
@@ -24,6 +24,7 @@
2424
2525 private static final int toiletSize = 128;
2626 private static Image images;
27+ private static int value = 200;
2728
2829 public static void loadImages (ClassLoader loader) throws IOException {
2930 final String path = "images/";
@@ -44,6 +45,11 @@
4445 return toiletSize;
4546 }
4647
48+ @Override
49+ public int getValue() {
50+ return value;
51+ }
52+
4753 public Toilet(int initX, int initY) {
4854 objType = Type.TOILET;
4955 x = initX;
--- branches/cantreadcode/OrangePool.java (revision 229)
+++ branches/cantreadcode/OrangePool.java (revision 230)
@@ -10,7 +10,7 @@
1010
1111 public static List<ObjEX> objEXList = new ArrayList<ObjEX>();
1212
13- public static final int type = 0;
13+ public int type = 0;
1414 public static final int hitCheckObjType = 1;
1515 public static final int size = 128;
1616 private static final int images_num = 1; //このクラスの総使用画像数
@@ -17,6 +17,9 @@
1717 private static final int anime_pattern = 1; //このクラスのアニメーション数
1818 private static int AnimeImagesNum[] = {1};//アニメごとに何枚使うか
1919 private static Image[] images = new Image[images_num];
20+ private boolean rescue;
21+ private static int[] value = {500,10000};
22+ private static int[] cost = {10,200};
2023
2124 public static void loadImages (ClassLoader loader) throws IOException {
2225 final String path = "images/";
@@ -62,7 +65,6 @@
6265
6366 @Override
6467 public int objHitProcess( Obj o ) {
65-
6668 if ( o.objType == Obj.Type.YUKKURI ){
6769 Body b = (Body)o;
6870 b.giveJuice();
@@ -69,11 +71,28 @@
6971 if ( b.isDirty() == true ) {
7072 b.dirty = false;
7173 }
74+ if ( rescue ) {
75+ if ( b.isDead() && !b.isCrashed() ){
76+ b.revival();
77+ }
78+ b.setCantDie();
79+ }
80+ Cash.addCash(-getCost());
7281 }
7382 return 0;
7483 }
84+
85+ @Override
86+ public int getValue() {
87+ return value[type];
88+ }
7589
7690 @Override
91+ public int getCost() {
92+ return cost[type];
93+ }
94+
95+ @Override
7796 public void removeListData(){
7897 objEXList.remove(this);
7998 }
@@ -81,6 +100,17 @@
81100 public OrangePool(int initX, int initY, Direction initDir) {
82101 super(initX, initY, ObjEX.Direction.BACK);
83102 objEXList.add(this);
103+ switch ( initDir ) { //方向データを仮利用
104+ case BACK:
105+ default:
106+ rescue = false;
107+ type = 0;
108+ break;
109+ case THISSIDE:
110+ rescue = true;
111+ type = 1;
112+ break;
113+ }
84114 objType = Type.PLATFORM;
85115 }
86116 }
\ No newline at end of file
--- branches/cantreadcode/Shit.java (revision 229)
+++ branches/cantreadcode/Shit.java (revision 230)
@@ -34,6 +34,10 @@
3434 private int amount = 0;
3535
3636 private static final int[] shitSize = {10, 20, 30};
37+
38+
39+ private static final int value[] = {-50,-100,-300};
40+
3741 private static Image[][] images = new Image[NUM_OF_SHIT_STATE][3];
3842
3943 public static void loadImages (ClassLoader loader) throws IOException {
@@ -108,6 +112,10 @@
108112 kick(0, blowLevel[ageState.ordinal()]*2, blowLevel[ageState.ordinal()]);
109113 }
110114
115+ public int getValue() {
116+ return value[ageState.ordinal()];
117+ }
118+
111119 public Event clockTick()
112120 {
113121 if (removed == false) {
--- branches/cantreadcode/FoodMaker.java (revision 229)
+++ branches/cantreadcode/FoodMaker.java (revision 230)
@@ -12,7 +12,7 @@
1212
1313 public static List<ObjEX> objEXList = new ArrayList<ObjEX>();
1414
15- public static final int type = 0;
15+ public int type = 0;
1616 public static final int hitCheckObjType = 7;
1717 public static final int size = 128;
1818 private static final int images_num = 6; //このクラスの総使用画像数
@@ -21,6 +21,9 @@
2121 private static Image[] images = new Image[images_num];
2222 protected Random rnd = new Random();
2323
24+ protected boolean processReady = true;
25+ private static int value = 30000;
26+ private static int cost = 20;
2427 protected int stockFood = -1;
2528 private static final int numOfBodyType = 5;
2629 private static final int numOfFoodType = 5;
@@ -91,8 +94,11 @@
9194
9295 @Override
9396 public int objHitProcess( Obj o ) {
97+ if ( !processReady ){
98+ return 0;
99+ }
94100 Food.type foodType = null;
95- if (stockFood == -1 ){
101+ if (stockFood == -1){
96102 if ( o.objType == Obj.Type.YUKKURI ){
97103 Body b = (Body)o;
98104 if ( b.isCrashed() == true || b.isBaby() == true ) {
@@ -108,6 +114,7 @@
108114 if ( b.isAdult() == true ) {
109115 objHitProcess( o );
110116 }else{
117+ processReady = false;
111118 b.remove();
112119 }
113120 }
@@ -135,10 +142,12 @@
135142 default:
136143 break;
137144 }
145+ processReady = false;
138146 f.remove();
139147 }else if ( o.objType == Obj.Type.SHIT ){
140148 Shit s = (Shit)o;
141149 stockFood = numOfBodyType+numOfFoodType;
150+ processReady = false;
142151 s.remove();
143152 }
144153 }else{
@@ -154,6 +163,8 @@
154163 }else{
155164 foodType = foodTable[makeTable[stockFood][b.getType()]];
156165 }
166+ processReady = false;
167+ Cash.addCash(-getCost());
157168 b.remove();
158169 }
159170 }else if ( o.objType == Obj.Type.FOOD ){
@@ -180,10 +191,14 @@
180191 default:
181192 break;
182193 }
194+ processReady = false;
195+ Cash.addCash(-getCost());
183196 f.remove();
184197 }else if ( o.objType == Obj.Type.SHIT ){
185198 Shit s = (Shit)o;
186199 foodType = foodTable[makeTable[stockFood][numOfBodyType+numOfFoodType]];
200+ processReady = false;
201+ Cash.addCash(-getCost());
187202 s.remove();
188203 }
189204 if (foodType == null) {
@@ -198,8 +213,25 @@
198213 }
199214 return 0;
200215 }
216+
217+ @Override
218+ public void upDate() {
219+ if ( age % 4 == 0 && processReady == false ){
220+ processReady = true;
221+ }
222+ }
201223
202224 @Override
225+ public int getValue() {
226+ return value;
227+ }
228+
229+ @Override
230+ public int getCost() {
231+ return cost;
232+ }
233+
234+ @Override
203235 public void removeListData(){
204236 objEXList.remove(this);
205237 }
@@ -208,5 +240,6 @@
208240 super(initX, initY, ObjEX.Direction.BACK);
209241 objEXList.add(this);
210242 objType = Type.PLATFORM;
243+ Cash.addCash(-getValue());
211244 }
212245 }
\ No newline at end of file
--- branches/cantreadcode/ObjEX.java (revision 229)
+++ branches/cantreadcode/ObjEX.java (revision 230)
@@ -71,7 +71,14 @@
7171 public int objHitProcess( Obj o ) {
7272 return 0;
7373 }
74+
75+ public void upDate() {
76+ }
7477
78+ public void buyObj() {
79+ Cash.addCash(-getValue());
80+ }
81+
7582 @Override
7683 public Event clockTick()
7784 {
@@ -122,6 +129,7 @@
122129 }
123130 }
124131 }
132+ upDate();
125133 return Event.DONOTHING;
126134 }
127135
@@ -136,5 +144,6 @@
136144 y = initY;
137145 z = 0;
138146 direction = initDir;
147+ //Cash.addCash(-getValue());
139148 }
140149 }
\ No newline at end of file
--- branches/cantreadcode/ProductChute.java (nonexistent)
+++ branches/cantreadcode/ProductChute.java (revision 230)
@@ -0,0 +1,102 @@
1+import java.awt.Image;
2+import java.io.IOException;
3+
4+import javax.imageio.ImageIO;
5+
6+import java.util.ArrayList;
7+import java.util.List;
8+import java.util.Random;
9+
10+public class ProductChute extends ObjEX implements java.io.Serializable {
11+ static final long serialVersionUID = 1L;
12+
13+ public static List<ObjEX> objEXList = new ArrayList<ObjEX>();
14+
15+ public static final int type = 0;
16+ public static final int hitCheckObjType = 31;
17+ public static final int size = 128;
18+ private static final int images_num = 1; //このクラスの総使用画像数
19+ private static final int anime_pattern = 1; //このクラスのアニメーション数
20+ private static int AnimeImagesNum[] = {1};//アニメごとに何枚使うか
21+ private static Image[] images = new Image[images_num];
22+ protected Random rnd = new Random();
23+ private static int value = 5000;
24+ private static int cost = 10;
25+
26+ public static void loadImages (ClassLoader loader) throws IOException {
27+ final String path = "images/";
28+ images[0] = ImageIO.read(loader.getResourceAsStream(path+"productchute.png"));
29+ images[0] = images[0].getScaledInstance(size*9/8, size*3/4, Image.SCALE_AREA_AVERAGING);
30+ }
31+
32+ public Image getImage(){
33+ return images[0];
34+ }
35+
36+ @Override
37+ public int getSize() {
38+ return size;
39+ }
40+
41+ @Override
42+ public int getHitCheckObjType() {
43+ return hitCheckObjType;
44+ }
45+
46+ @Override
47+ public int checkHitObj( Obj o ) {
48+ int objX = o.getX();
49+ int objY = o.getY();
50+ int objZ = o.getZ();
51+ int platformSize = getSize()/2;
52+ int platformX = getX();
53+ int platformY = getY();
54+ int platformZ = getZ();
55+ int offsetX = (Body.MAXSIZE - getSize())*7/32-28;
56+ int offsetY = (Body.MAXSIZE - getSize())*6/16-40;
57+ if ( objZ == 0 ){ //空中の物は移動させない
58+ if ((platformX + offsetX)<=(objX) && (objX)<=(platformX + offsetX + platformSize)){ //X軸比較
59+ if ((platformY + offsetY)<=(objY) && (objY)<=(platformY + offsetY + platformSize)){ //Y軸比較
60+ objHitProcess( o );
61+ return 1;
62+ }
63+ }
64+ }
65+ return 0;
66+ }
67+
68+ @Override
69+ public int objHitProcess( Obj o ) {
70+ if ( o.objType == Obj.Type.YUKKURI ){
71+ Cash.addCash( -o.getValue()*10 );
72+ }else if ( o.objType == Obj.Type.FOOD ) {
73+ Cash.addCash( o.getValue()/2 );
74+ }else{
75+ Cash.addCash( -o.getValue()*2 );
76+ }
77+ Cash.addCash( -getCost() );
78+ o.remove();
79+ return 0;
80+ }
81+
82+ @Override
83+ public int getValue() {
84+ return value;
85+ }
86+
87+ @Override
88+ public int getCost() {
89+ return cost;
90+ }
91+
92+ @Override
93+ public void removeListData(){
94+ objEXList.remove(this);
95+ }
96+
97+ public ProductChute(int initX, int initY, Direction initDir) {
98+ super(initX, initY, ObjEX.Direction.BACK);
99+ objEXList.add(this);
100+ objType = Type.PLATFORM;
101+ }
102+}
\ No newline at end of file
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- branches/cantreadcode/BreedingPool.java (revision 229)
+++ branches/cantreadcode/BreedingPool.java (revision 230)
@@ -12,7 +12,7 @@
1212
1313 public static List<ObjEX> objEXList = new ArrayList<ObjEX>();
1414
15- public static final int type = 0;
15+ public int type = 0;
1616 public static final int hitCheckObjType = 1;
1717 public static final int size = 128;
1818 private static final int images_num = 1; //このクラスの総使用画像数
@@ -23,7 +23,10 @@
2323
2424 private boolean highDensity;
2525 private boolean rapidGrowth;
26+ private static int[] value = {1000,4000,4000,10000};
27+ private static int[] cost = {50,180,180,350};
2628
29+
2730 public static void loadImages (ClassLoader loader) throws IOException {
2831 final String path = "images/";
2932 images[0] = ImageIO.read(loader.getResourceAsStream(path+"breedingpool.png"));
@@ -46,9 +49,9 @@
4649
4750 @Override
4851 public int objHitProcess( Obj o ) {
49- if ( o.objType == Obj.Type.YUKKURI ){
50- Body p = (Body)o;
51- if ( p.isDead() == false && (int)age % ((highDensity==true)?4:10) == 0 ) {
52+ if ( o.objType == Obj.Type.YUKKURI ){
53+ Body p = (Body)o;
54+ if ( p.isDead() == false && (int)age % ((highDensity==true)?4:10) == 0 ) {
5255 int babyType;
5356 babyType = p.getType();
5457 if ((babyType == Reimu.type) && rnd.nextBoolean()) {
@@ -64,7 +67,8 @@
6467 p.hasBaby = true;
6568 if (rapidGrowth == true){
6669 p.rapidPregnantPeriod();
67- }
70+ }
71+ Cash.addCash(-getCost());
6872 }
6973 }
7074 return 0;
@@ -71,6 +75,16 @@
7175 }
7276
7377 @Override
78+ public int getValue() {
79+ return value[type];
80+ }
81+
82+ @Override
83+ public int getCost() {
84+ return cost[type];
85+ }
86+
87+ @Override
7488 public void removeListData(){
7589 objEXList.remove(this);
7690 }
@@ -98,5 +112,6 @@
98112 break;
99113 }
100114 objType = Type.PLATFORM;
115+ type = initDir.ordinal();
101116 }
102117 }
\ No newline at end of file
--- branches/cantreadcode/Terrarium.java (revision 229)
+++ branches/cantreadcode/Terrarium.java (revision 230)
@@ -62,6 +62,7 @@
6262 out.writeObject(GarbageChute.objEXList);
6363 out.writeObject(FoodMaker.objEXList);
6464 out.writeObject(OrangePool.objEXList);
65+ out.writeObject(ProductChute.objEXList);
6566
6667 out.writeObject(MachinePress.objEXList);
6768
@@ -93,6 +94,7 @@
9394 ArrayList<ObjEX> garbageChuteList;
9495 ArrayList<ObjEX> foodMakerList;
9596 ArrayList<ObjEX> orangePoolList;
97+ ArrayList<ObjEX> productChuteList;
9698
9799 ArrayList<ObjEX> machinePressList;
98100
@@ -118,6 +120,7 @@
118120 garbageChuteList = (ArrayList<ObjEX>)in.readObject();
119121 foodMakerList = (ArrayList<ObjEX>)in.readObject();
120122 orangePoolList = (ArrayList<ObjEX>)in.readObject();
123+ productChuteList = (ArrayList<ObjEX>)in.readObject();
121124
122125 machinePressList = (ArrayList<ObjEX>)in.readObject();
123126
@@ -140,6 +143,7 @@
140143 GarbageChute.objEXList = garbageChuteList;
141144 FoodMaker.objEXList = foodMakerList;
142145 OrangePool.objEXList = orangePoolList;
146+ ProductChute.objEXList = productChuteList;
143147
144148 MachinePress.objEXList = machinePressList;
145149
@@ -164,6 +168,7 @@
164168 objList.addAll(GarbageChute.objEXList);
165169 objList.addAll(FoodMaker.objEXList);
166170 objList.addAll(OrangePool.objEXList);
171+ objList.addAll(ProductChute.objEXList);
167172 return objList;
168173 }
169174
@@ -476,7 +481,7 @@
476481
477482 private boolean checkFood(Body b) {
478483 boolean ret = false;
479- if (b.isExciting() || b.isSleeping() || b.isDead() || b.isFull() || b.isScare() || b.isSick()) {
484+ if (b.isExciting() || b.isSleeping() || b.isDead() || b.isFull() || b.isScare() || b.isSick() || b.isFeelHardPain()) {
480485 return false;
481486 }
482487 if (!b.isRude() && !b.isIdiot() && b.wantToShit()) {
@@ -747,6 +752,12 @@
747752 babyList.get(babyList.size()-1).kick(0,5,-2);
748753
749754 }
755+
756+ private void addBaby(int x, int y, int z, int vx, int vy, int vz, int type, Body p1, Body p2) {
757+ babyList.add(makeBody(x, y, z + 1, type, Body.AgeState.BABY, p1, p2));
758+ babyList.get(babyList.size()-1).kick(vx,vy,vz);
759+
760+ }
750761
751762 public Body makeBody(int x, int y, int z, int type, Body.AgeState age, Body p1, Body p2) {
752763 Body b;
@@ -796,6 +807,7 @@
796807
797808 public void addToy(int x, int y) {
798809 toyList.add(new Toy(x, y));
810+ Cash.addCash( -toyList.get(toyList.size()-1).getValue() );
799811 }
800812
801813 public void addCrushedShit(int x, int y, int z, Body.AgeState ageState) {
@@ -806,31 +818,37 @@
806818
807819 public void addToilet(int x, int y) {
808820 toiletList.add(new Toilet(x, y));
821+ Cash.addCash( -toiletList.get(toiletList.size()-1).getValue() );
809822 }
810823
811824 public void addObjEX( int addObjEX, int x, int y, ObjEX.Direction dir) {
825+ ObjEX objEX = null;
812826 switch(addObjEX){
813827 case SimYukkuri.BELTCONVEYOR:
814- new Beltconveyor(x, y, dir);
828+ objEX = new Beltconveyor(x, y, dir);
815829 break;
816830 case SimYukkuri.BREEDINGPOOL:
817- new BreedingPool(x, y, dir);
831+ objEX = new BreedingPool(x, y, dir);
818832 break;
819833 case SimYukkuri.GARBAGECHUTE:
820- new GarbageChute(x, y, dir);
834+ objEX = new GarbageChute(x, y, dir);
821835 break;
822836 case SimYukkuri.MACHINEPRESS:
823- new MachinePress(x, y, dir);
837+ objEX = new MachinePress(x, y, dir);
824838 break;
825839 case SimYukkuri.FOODMAKER:
826- new FoodMaker(x, y, dir);
840+ objEX = new FoodMaker(x, y, dir);
827841 break;
828842 case SimYukkuri.ORANGEPOOL:
829- new OrangePool(x, y, dir);
843+ objEX = new OrangePool(x, y, dir);
830844 break;
845+ case SimYukkuri.PRODUCTCHUTE:
846+ objEX = new ProductChute(x, y, dir);
847+ break;
831848 default:
832849 break;
833850 }
851+ objEX.buyObj();
834852 }
835853
836854 public static void setAlarm() {
@@ -966,13 +984,22 @@
966984 ret = b.clockTick();
967985 switch (ret) {
968986 case DEAD:
987+ if (b.getBabyTypes().size() >= b.getMaxHaveBaby()/120) {
988+ int numOfBaby = b.getBabyTypes().size();
989+ for ( int babyTypes:b.getBabyTypes()) {
990+ addBaby(b.getX(), b.getY(), b.getZ()+b.getSize()/20, rnd.nextInt(numOfBaby/4+1)-numOfBaby/8, rnd.nextInt(numOfBaby/4+1)-numOfBaby/8, rnd.nextInt(numOfBaby/4+1)-numOfBaby/8-2, babyTypes, b, b.partner);
991+ }
992+ b.getBabyTypes().clear();
993+ if ( b.isCrashed() == false ) {
994+ b.strikeByPress();
995+ }
996+ }
969997 continue;
970998 case BIRTHBABY:
971- //for (int babyType:b.getBabyTypes()) {
972999 if ( b.age % 10 == 0 ){
973- int babytype = b.getBabyTypesDequeue();
974- if ( babytype != -1 ){
975- addBaby(b.getX(), b.getY(), b.getZ()+b.getSize()/15, babytype, b, b.partner);
1000+ int babyType = b.getBabyTypesDequeue();
1001+ if ( babyType != -1 ){
1002+ addBaby(b.getX(), b.getY(), b.getZ()+b.getSize()/15, babyType, b, b.partner);
9761003 }
9771004 }
9781005 break;
--- branches/cantreadcode/Obj.java (revision 229)
+++ branches/cantreadcode/Obj.java (revision 230)
@@ -20,6 +20,9 @@
2020 public enum Type {YUKKURI, SHIT, FOOD, TOILET, TOY, PLATFORM, FIX_OBJECT}
2121 public enum Event {DONOTHING, BIRTHBABY, DOSHIT, DEAD, REMOVED}
2222
23+ protected static final int value = 0;
24+ protected static final int cost = 0;
25+
2326 public static final int TICK = 1;
2427
2528 // basic attributes
@@ -117,6 +120,14 @@
117120 return objType;
118121 }
119122
123+ public int getValue() {
124+ return value;
125+ }
126+
127+ public int getCost() {
128+ return cost;
129+ }
130+
120131 public void remove() {
121132 removed = true;
122133 }
--- branches/cantreadcode/Toy.java (revision 229)
+++ branches/cantreadcode/Toy.java (revision 230)
@@ -28,6 +28,7 @@
2828 private static int toysize = 16;
2929 private static Image[] images = new Image[NUM_OF_BALL_IMG];
3030 private Body owner = null;
31+ private static int value = 100;
3132
3233 public static void loadImages (ClassLoader loader) throws IOException {
3334 final String path = "images/toy/";
@@ -76,7 +77,12 @@
7677 public boolean isOwned(Body b) {
7778 return (owner == b);
7879 }
79-
80+
81+ @Override
82+ public int getValue() {
83+ return value;
84+ }
85+
8086 public Toy(int initX, int initY) {
8187 objType = Type.TOY;
8288 x = initX;
--- branches/cantreadcode/Beltconveyor.java (revision 229)
+++ branches/cantreadcode/Beltconveyor.java (revision 230)
@@ -10,7 +10,7 @@
1010
1111 public static List<ObjEX> objEXList = new ArrayList<ObjEX>();
1212
13- public static final int type = 0;
13+ public int type = 0;
1414 public static final int hitCheckObjType = 31;
1515 public static final int size = 128;
1616 private static final int images_num = 10; //このクラスの総使用画像数
@@ -19,6 +19,8 @@
1919 private static Image[] images = new Image[images_num];
2020
2121 private int beltSpeed;
22+ private static final int value = 2000;
23+ private static final int cost = 5;
2224
2325 public static void loadImages (ClassLoader loader) throws IOException {
2426 final String path = "images/beltconveyor/";
@@ -78,11 +80,33 @@
7880 return 0;
7981 }
8082
83+ @Override
84+ public void upDate() {
85+ if ( age % 150 == 0 ){
86+ Cash.addCash(-getCost()/4);
87+ }
88+ }
89+
8190 public int getBeltSpeed() {
8291 return beltSpeed;
8392 }
8493
8594 @Override
95+ public int getValue() {
96+ return value;
97+ }
98+
99+ @Override
100+ public int getCost() {
101+ return cost;
102+ }
103+
104+ @Override
105+ public void buyObj() {
106+ Cash.addCash(-getValue());
107+ }
108+
109+ @Override
86110 public void removeListData(){
87111 objEXList.remove(this);
88112 }
--- branches/cantreadcode/SimYukkuri.java (revision 229)
+++ branches/cantreadcode/SimYukkuri.java (revision 230)
@@ -44,7 +44,7 @@
4444 static final Object lock = new Object();
4545 static boolean initialized = false;
4646
47- static final int TOOL = 0, FOOD = 1, CLEAN = 2, ACCESSORY = 3, PICKUP = 4, PANTS = 5, TOILET = 6, BARRIER = 7, TOYS = 8, BELTCONVEYOR = 9, BREEDINGPOOL = 10 ,GARBAGECHUTE = 11, MACHINEPRESS = 12, FOODMAKER = 13, ORANGEPOOL = 14;
47+ static final int TOOL = 0, FOOD = 1, CLEAN = 2, ACCESSORY = 3, PICKUP = 4, PANTS = 5, TOILET = 6, BARRIER = 7, TOYS = 8, BELTCONVEYOR = 9, BREEDINGPOOL = 10 ,GARBAGECHUTE = 11, MACHINEPRESS = 12, FOODMAKER = 13, ORANGEPOOL = 14, PRODUCTCHUTE = 15;
4848
4949 static final int PUNISH = 0, HAMMER = 1, VIBRATOR = 2, JUICE = 3, DECOPING = 4;
5050
@@ -53,7 +53,7 @@
5353 static final int NORMAL = 0, BITTER = 1, SELFFEEDER = 2, LEMONPOP = 3, HOT = 4, VIYUGRA = 5;
5454 static final int INDIVIDUAL = 0, ALL = 1;
5555 static final int SET = 0, DEL = 1;
56- static int selectedTool = 0, selectedFood = 0, selectedCleaner = 0, selectedBarrier = 0, selectedBeltconveyor = 0, selectedBreedingPool = 0, selectedGameSpeed = 1;
56+ static int selectedTool = 0, selectedFood = 0, selectedCleaner = 0, selectedBarrier = 0, selectedBeltconveyor = 0, selectedBreedingPool = 0, selectedOrangePool = 0, selectedGameSpeed = 1;
5757 JLabel title;
5858 JPanel rootPane = new JPanel();
5959 JPanel buttonPane = new JPanel();
@@ -173,7 +173,7 @@
173173 if(language == Body.Language.ENGLISH) {
174174 title.setText("SimYukkuri " + VERSION + " ");
175175 final int selectedIndex = s1.getSelectedIndex();
176- s1.setModel(new DefaultComboBoxModel(new String[]{"Tool", "Food", "Clean", "Accessory", "Pick up", "Pants", "Toilet", "Barrier", "Toys", "Belt conveyor", "Breeding pool", "Garbage chute", "Machine press", "Food maker","Orange pool"}));
176+ s1.setModel(new DefaultComboBoxModel(new String[]{"Tool", "Food", "Clean", "Accessory", "Pick up", "Pants", "Toilet", "Barrier", "Toys", "Belt conveyor", "Breeding pool", "Garbage chute", "Machine press", "Food maker","Orange pool", "Product chute"}));
177177 if(selectedIndex > -1)
178178 s1.setSelectedIndex(selectedIndex);
179179 s3.setModel(new DefaultComboBoxModel(new String[]{"Pause", "Speed: x1", "Speed: x5", "Speed: x10", "Speed: MAX"}));
@@ -199,7 +199,7 @@
199199 title.setText("しむゆっくり " + VERSION + " ");
200200 final int selectedIndex = s1.getSelectedIndex();
201201
202- s1.setModel(new DefaultComboBoxModel(new String[]{"道具", "えさ", "清掃", "おかざり", "持ち上げる", "おくるみ", "トイレ", "壁", "おもちゃ", "ベルトコンベア", "養殖プール", "ダストシュート", "プレス機", "フードメーカー", "オレンジプール"}));
202+ s1.setModel(new DefaultComboBoxModel(new String[]{"道具", "えさ", "清掃", "おかざり", "持ち上げる", "おくるみ", "トイレ", "壁", "おもちゃ", "ベルトコンベア", "養殖プール", "ダストシュート", "プレス機", "フードメーカー", "オレンジプール", "製品投入口"}));
203203
204204 if(selectedIndex > -1)
205205 s1.setSelectedIndex(selectedIndex);
@@ -246,9 +246,14 @@
246246 break;
247247
248248 case BELTCONVEYOR:
249- s2.setModel(new DefaultComboBoxModel(new String[]{" Low-priced", "High density", "Rapid growth", "High-grade"}));
249+ s2.setModel(new DefaultComboBoxModel(new String[]{" Low-priced", "High-density", "Rapid-growth", "High-grade"}));
250250 s2.setSelectedIndex(selectedBreedingPool);
251251 break;
252+
253+ case ORANGEPOOL:
254+ s2.setModel(new DefaultComboBoxModel(new String[]{"For drink", "For rescue use"}));
255+ s2.setSelectedIndex(selectedBreedingPool);
256+ break;
252257
253258 default:
254259 s2.setModel(new DefaultComboBoxModel(new String[]{" "}));
@@ -284,6 +289,11 @@
284289 s2.setModel(new DefaultComboBoxModel(new String[]{"廉価品", "こくまろ", "高速成長薬添加", "プロ用"}));
285290 s2.setSelectedIndex(selectedBreedingPool);
286291 break;
292+
293+ case ORANGEPOOL:
294+ s2.setModel(new DefaultComboBoxModel(new String[]{"清涼飲料水", "救命用"}));
295+ s2.setSelectedIndex(selectedOrangePool);
296+ break;
287297
288298 default:
289299 s2.setModel(new DefaultComboBoxModel(new String[]{" "}));
@@ -401,7 +411,7 @@
401411 myPane.showLog = !myPane.showLog;
402412 }
403413 else if(source.equals(nextPageLogButton)) {
404- if ( myPane.showPage > 2 ){
414+ if ( myPane.showPage >= 4 ){
405415 myPane.showPage = 0;
406416 }else{
407417 myPane.showPage++;
@@ -709,6 +719,7 @@
709719 break;
710720 }
711721 mypane.terrarium.addFood(x, y, foodType);
722+ Cash.addCash( -mypane.terrarium.foodList.get(mypane.terrarium.foodList.size()-1).getValue() );
712723 }
713724 }
714725 break;
@@ -842,11 +853,40 @@
842853 int x = Translate.invX(X, Y, Terrarium.MAX_X, Terrarium.MAX_Y);
843854 int y = Translate.invY(X, Y, Terrarium.MAX_X, Terrarium.MAX_Y);
844855 if (x >= 0 && x <= Terrarium.MAX_X && y >= 0 && y <= Terrarium.MAX_Y) {
845- mypane.terrarium.addObjEX(ORANGEPOOL, x, y, ObjEX.Direction.BACK);
856+ ObjEX.Direction dir;
857+ switch (s2.getSelectedIndex()) {
858+ case BACK:
859+ default:
860+ dir = ObjEX.Direction.BACK;
861+ break;
862+ case THISSIDE:
863+ dir = ObjEX.Direction.THISSIDE;
864+ break;
865+ case RIGHT:
866+ dir = ObjEX.Direction.BACK;
867+ break;
868+ case LEFT:
869+ dir = ObjEX.Direction.BACK;
870+ break;
871+ }
872+ mypane.terrarium.addObjEX(ORANGEPOOL, x, y, dir);
846873 }
847874 }
848875 break;
849876
877+ case PRODUCTCHUTE: {
878+ int offsetX = (Body.MAXSIZE - GarbageChute.getSizeS())/2;
879+ int offsetY = (Body.MAXSIZE - GarbageChute.getSizeS()/2);
880+ int X = (e.getX() - offsetX)*Terrarium.MAX_X/(w-Body.MAXSIZE);
881+ int Y = (e.getY() - offsetY)*Terrarium.MAX_Y/(h-Body.MAXSIZE);
882+ int x = Translate.invX(X, Y, Terrarium.MAX_X, Terrarium.MAX_Y);
883+ int y = Translate.invY(X, Y, Terrarium.MAX_X, Terrarium.MAX_Y);
884+ if (x >= 0 && x <= Terrarium.MAX_X && y >= 0 && y <= Terrarium.MAX_Y) {
885+ mypane.terrarium.addObjEX(PRODUCTCHUTE, x, y, ObjEX.Direction.BACK);
886+ }
887+ }
888+ break;
889+
850890 default://Other tool
851891 break;
852892 }
@@ -1117,6 +1157,7 @@
11171157 GarbageChute.loadImages(loader);
11181158 FoodMaker.loadImages(loader);
11191159 OrangePool.loadImages(loader);
1160+ ProductChute.loadImages(loader);
11201161
11211162 MachinePress.loadImages(loader);
11221163
@@ -1272,6 +1313,7 @@
12721313 for (Body b: bodies) {
12731314 synchronized(SimYukkuri.lock) {
12741315 terrarium.addBody(b);
1316+ Cash.addCash( -b.getValue() );
12751317 }
12761318 }
12771319 }
@@ -1407,9 +1449,9 @@
14071449 img = b.getImage(Body.SLEEPING,direction);
14081450 }
14091451 else if (b.isPeroPero() || b.isEating()) {
1410- if (b.isStrike() || b.isVerySad())
1452+ if (b.isStrike() || b.isVerySad() || b.isFeelHardPain() )
14111453 img = b.getImage(Body.CRYING,direction);
1412- else if (b.isSad() || b.isEatingShit())
1454+ else if (b.isSad() || b.isEatingShit() || b.isFeelPain() )
14131455 img = b.getImage(Body.TIRED, direction);
14141456 else
14151457 img = b.getImage(Body.SMILE, direction);
@@ -1417,8 +1459,8 @@
14171459 else if (b.isSukkiri()) {
14181460 img = b.getImage(Body.REFRESHED,direction);
14191461 }
1420- else if (b.isDamaged() || b.isSick()) {
1421- if (b.isStrike() || b.isVerySad())
1462+ else if (b.isDamaged() || b.isSick() || b.isFeelPain() ) {
1463+ if (b.isStrike() || b.isVerySad() || b.isFeelHardPain() )
14221464 img = b.getImage(Body.CRYING,direction);
14231465 else
14241466 img = b.getImage(Body.TIRED,direction);
@@ -1562,6 +1604,7 @@
15621604 int[] numOfObjNowLog = Logger.getNumOfObjNowLog();
15631605 int numOfMaxYukkuri = 0;
15641606 int numOfMaxUnun = 0;
1607+ int numOfMaxCash = 0;
15651608 int numOfSumYukkuri = 0;
15661609 int[] logDataTmp;
15671610 int operationTime = Terrarium.operationTime / 10;
@@ -1580,6 +1623,10 @@
15801623 if ( numOfMaxUnun < logDataTmp[Logger.NUM_OF_SHIT] ){
15811624 numOfMaxUnun = logDataTmp[Logger.NUM_OF_SHIT];
15821625 }
1626+
1627+ if ( numOfMaxCash < logDataTmp[Logger.NUM_OF_CASH] ){
1628+ numOfMaxCash = logDataTmp[Logger.NUM_OF_CASH];
1629+ }
15831630 for( int j = 0 ; j < Logger.NUM_OF_LOGDATA_TYPE ; j++ ){
15841631 logData[ Logger.NUM_OF_LOGDATA_TYPE * i + j ] = logDataTmp[j];
15851632 }
@@ -1762,6 +1809,38 @@
17621809 g.drawString( "0", GRAPH_OFFSETX - 12 , GRAPH_OFFSETY + GRAPH_HEIGHT );
17631810
17641811 break;
1812+ case 4:
1813+ g.drawString( "収入・支出", 100, 100 );
1814+ g.setFont( textFonttext );
1815+ for ( int i = 0 ; i < 1 ; i++ ){
1816+ g.setColor( Color.WHITE );
1817+ g.drawString( Integer.toString( numOfObjNowLog[ i + Logger.NUM_OF_CASH ] ), LEGEND_OFFSETX + 130, 30 * i + 140);
1818+
1819+ g.drawString( Integer.toString( numOfObjNowLog[ Logger.NUM_OF_CASH ] - logData[ Logger.NUM_OF_LOGDATA_TYPE * 59 + Logger.NUM_OF_CASH ] ), LEGEND_OFFSETX + 130, 30 * (i+1) + 140);
1820+ g.drawString( "所持金", LEGEND_OFFSETX, 30 * i + 140);
1821+ g.drawString( "収益(¥/分)", LEGEND_OFFSETX, 30 * (i+1) + 140);
1822+ g.setColor( Color.YELLOW );
1823+ if ( i == 0 ){
1824+ for( int k = 0 ; k < NUM_OF_GRAPH_DATA ; k++ ){
1825+ if ( logData[ Logger.NUM_OF_LOGDATA_TYPE * k + i + Logger.NUM_OF_CASH ] > 0 ){
1826+ yp[k] -= logData[ Logger.NUM_OF_LOGDATA_TYPE * k + i + Logger.NUM_OF_CASH ] * GRAPH_HEIGHT / numOfMaxCash;
1827+ } else if ( logData[ Logger.NUM_OF_LOGDATA_TYPE * k + i + Logger.NUM_OF_CASH ] == 0 ) {
1828+ yp[k] -= logData[ Logger.NUM_OF_LOGDATA_TYPE * k + i + Logger.NUM_OF_CASH ] * GRAPH_HEIGHT / 1;
1829+ }
1830+ }
1831+ g.fillPolygon( xp , yp, NUM_OF_GRAPH_DATA * 2);
1832+ }
1833+
1834+ for( int k = 0 ; k < NUM_OF_GRAPH_DATA ; k++ ){
1835+ yp[ NUM_OF_GRAPH_DATA * 2 - k - 1 ] = yp[ k ];
1836+ }
1837+ g.setColor( Color.WHITE );
1838+ g.drawRect( GRAPH_OFFSETX , GRAPH_OFFSETY, GRAPH_WIDTH, GRAPH_HEIGHT);
1839+ g.drawString( Integer.toString( numOfMaxCash ), GRAPH_OFFSETX - String.valueOf(numOfMaxCash).length() * 10 - 2 , GRAPH_OFFSETY );
1840+ g.drawString( Integer.toString( numOfMaxCash / 2 ), GRAPH_OFFSETX - String.valueOf(numOfMaxCash).length() * 10 - 2 , GRAPH_OFFSETY + GRAPH_HEIGHT / 2 );
1841+ g.drawString( "0", GRAPH_OFFSETX - 12 , GRAPH_OFFSETY + GRAPH_HEIGHT );
1842+ }
1843+ break;
17651844 default:
17661845 break;
17671846 }
--- branches/cantreadcode/Cash.java (nonexistent)
+++ branches/cantreadcode/Cash.java (revision 230)
@@ -0,0 +1,14 @@
1+import java.util.ArrayList;
2+import java.util.List;
3+
4+public class Cash {
5+
6+ public static int cash = 5000;
7+
8+ public static void addCash( int addcash ){
9+ cash += addcash;
10+ }
11+
12+
13+
14+}
\ No newline at end of file
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- branches/cantreadcode/Logger.java (revision 229)
+++ branches/cantreadcode/Logger.java (revision 230)
@@ -14,7 +14,8 @@
1414 public static final int NUM_OF_ADULT = 8;
1515 public static final int NUM_OF_SICK = 9;
1616 public static final int NUM_OF_SHIT = 10;
17- public static final int NUM_OF_LOGDATA_TYPE = 11;
17+ public static final int NUM_OF_CASH = 11;
18+ public static final int NUM_OF_LOGDATA_TYPE = 12;
1819
1920 private static int[] prevLogData = new int[NUM_OF_LOGDATA_TYPE];
2021 private static int[] logDataSum = new int[NUM_OF_LOGDATA_TYPE];
@@ -77,6 +78,8 @@
7778 logData[NUM_OF_SHIT]++;
7879 }
7980
81+ logData[NUM_OF_CASH] = Cash.cash;
82+
8083 for ( int i = 0 ; i < NUM_OF_LOGDATA_TYPE ; i++ ) {
8184 logList.add( logData[i] );
8285 logDataSum[i] += logData[i] - prevLogData[i];
--- branches/cantreadcode/MachinePress.java (revision 229)
+++ branches/cantreadcode/MachinePress.java (revision 230)
@@ -10,7 +10,7 @@
1010
1111 public static List<ObjEX> objEXList = new ArrayList<ObjEX>();
1212
13- public static final int type = 0;
13+ public int type = 0;
1414 public static final int hitCheckObjType = 3;
1515 public static final int size = 256;
1616 private static final int images_num = 8; //このクラスの総使用画像数
@@ -18,7 +18,8 @@
1818 private static int AnimeImagesNum[] = {8};//アニメごとに何枚使うか
1919 private static Image[] images = new Image[images_num];
2020
21- private int running;
21+ private static final int value = 30000;
22+ private static final int cost = 100;
2223
2324 public static void loadImages (ClassLoader loader) throws IOException {
2425 final String path = "images/machinepress/";
@@ -67,6 +68,23 @@
6768 }
6869
6970 @Override
71+ public void upDate() {
72+ if ( age % 150 == 0 ){
73+ Cash.addCash(-getCost()/4);
74+ }
75+ }
76+
77+ @Override
78+ public int getValue() {
79+ return value;
80+ }
81+
82+ @Override
83+ public int getCost() {
84+ return cost;
85+ }
86+
87+ @Override
7088 public void removeListData(){
7189 objEXList.remove(this);
7290 }
--- branches/cantreadcode/GarbageChute.java (revision 229)
+++ branches/cantreadcode/GarbageChute.java (revision 230)
@@ -12,7 +12,7 @@
1212
1313 public static List<ObjEX> objEXList = new ArrayList<ObjEX>();
1414
15- public static final int type = 0;
15+ public int type = 0;
1616 public static final int hitCheckObjType = 31;
1717 public static final int size = 128;
1818 private static final int images_num = 1; //このクラスの総使用画像数
@@ -20,6 +20,8 @@
2020 private static int AnimeImagesNum[] = {1};//アニメごとに何枚使うか
2121 private static Image[] images = new Image[images_num];
2222 protected Random rnd = new Random();
23+ private static int value = 5000;
24+ private static int cost = 5;
2325
2426 public static void loadImages (ClassLoader loader) throws IOException {
2527 final String path = "images/";
@@ -66,8 +68,19 @@
6668 @Override
6769 public int objHitProcess( Obj o ) {
6870 o.remove();
71+ Cash.addCash(-getCost());
6972 return 0;
7073 }
74+
75+ @Override
76+ public int getValue() {
77+ return value;
78+ }
79+
80+ @Override
81+ public int getCost() {
82+ return cost;
83+ }
7184
7285 @Override
7386 public void removeListData(){
--- branches/cantreadcode/Food.java (revision 229)
+++ branches/cantreadcode/Food.java (revision 230)
@@ -37,6 +37,9 @@
3737 private int amount;
3838
3939 private static final int foodSize = 64;
40+
41+ private static final int value[] = {-100,250,250,10000,400,400,650,-100};
42+
4043 private static Image[] images = new Image[NUM_OF_FOOD_STATE];
4144
4245 public static void loadImages (ClassLoader loader) throws IOException {
@@ -88,6 +91,10 @@
8891 return foodSize;
8992 }
9093
94+ public int getValue() {
95+ return value[foodType.ordinal()];
96+ }
97+
9198 public Food(int initX, int initY, type initType) {
9299 objType = Type.FOOD;
93100 x = initX;
--- branches/cantreadcode/Body.java (revision 229)
+++ branches/cantreadcode/Body.java (revision 230)
@@ -73,7 +73,8 @@
7373
7474 // private variables
7575 protected enum Hunger { NONE, VERY };
76- protected enum Damage { NONE, VERY }
76+ protected enum Damage { NONE, VERY };
77+ protected enum Pain { NONE, SOME, VERY };
7778 protected enum Happiness { VERY_HAPPY, HAPPY, AVERAGE, SAD, VERY_SAD };
7879 protected enum Attitude { VERY_NICE, NICE, AVERAGE, SHITHEAD, SUPER_SHITHEAD };
7980
@@ -202,6 +203,9 @@
202203 protected int blockedCount = 0;
203204
204205 protected Random rnd = new Random();
206+
207+ protected int value[] = {10,100,300};
208+ protected int cantDiePeriod = 0;
205209
206210 // private methods
207211 private AgeState checkAgeState()
@@ -229,7 +233,7 @@
229233 private Damage checkDamageState()
230234 {
231235 if (damage > DAMAGELIMIT[ageState.ordinal()]) {
232- dead = true;
236+ toDead();
233237 return Damage.VERY;
234238 }
235239 if (damage >= DAMAGELIMIT[ageState.ordinal()]/2) {
@@ -237,6 +241,17 @@
237241 }
238242 return Damage.NONE;
239243 }
244+
245+ private Pain checkPainState()
246+ {
247+ if ( hasNearMaxNumBabies() ){
248+ return Pain.VERY;
249+ }
250+ if ( hasManyBabies() ){
251+ return Pain.SOME;
252+ }
253+ return Pain.NONE;
254+ }
240255
241256 private void checkHungry() {
242257 if (exciting || hasBaby) {
@@ -282,10 +297,10 @@
282297 private boolean checkShit() {
283298 boolean cantMove = false;
284299 if (checkHungryState() == Hunger.NONE) {
285- shit += TICK*2 + (shitBoost / 2);
300+ shit += TICK*2 + ( shitBoost/3*2 );
286301 }
287302 else {
288- shit += TICK + (shitBoost / 2);
303+ shit += TICK + ( shitBoost/3*2 );
289304 }
290305 if (shit > SHITLIMIT[ageState.ordinal()] - TICK*SHITSTAY) {
291306 if (hasPants) {
@@ -326,7 +341,7 @@
326341 private boolean checkChildbirth() {
327342 boolean cantMove = false;
328343 if (hasBaby || !hasBaby && birth) {
329- pregnantPeriod += TICK + (pregnantPeriodBoost * 4);
344+ pregnantPeriod += TICK + (pregnantPeriodBoost / 2);
330345 if (pregnantPeriod > PREGPERIOD - TICK*100) {
331346 if (!birth) {
332347 showBreed();
@@ -376,6 +391,12 @@
376391 }
377392 return sleeping;
378393 }
394+
395+ private void checkCantDie() {
396+ if ( cantDiePeriod > 0 ){
397+ cantDiePeriod -= TICK;
398+ }
399+ }
379400
380401 private void checkDiscipline() {
381402 int period = (isRude() ? 1 : 2) * DECLINEPERIOD;
@@ -425,7 +446,7 @@
425446 }
426447 if (noHungryPeriod > RELAXPERIOD && noDamagePeriod > RELAXPERIOD
427448 && !sleeping && !shitting && !eating
428- && !isSad() && !isVerySad() && !isSick()) {
449+ && !isSad() && !isVerySad() && !isSick()&&!isFeelPain()) {
429450 if (!exciting && !relax) {
430451 int r = 1;
431452 int adjust = excitingDiscipline*(isRude() ? 1 : 2);
@@ -646,7 +667,7 @@
646667
647668 // moving
648669 int step = STEP[ageState.ordinal()];
649- if (hasBaby || hungryState == Hunger.VERY || damageState == Damage.VERY || isSick()) {
670+ if (hasBaby || hungryState == Hunger.VERY || damageState == Damage.VERY || isSick() || isFeelPain()) {
650671 step /= 2;
651672 if (step == 0) {
652673 step = 1;
@@ -1526,7 +1547,7 @@
15261547 }
15271548
15281549 public int getSize() {
1529- return diameter[ageState.ordinal()] + (20 - 20/(getBabyTypes().size() + 1 )) + getBabyTypes().size();
1550+ return diameter[ageState.ordinal()] + (20 - 20/(getBabyTypes().size() + 1 )) + getBabyTypes().size() *2;
15301551 }
15311552
15321553 public int getOriginSize() {
@@ -1557,6 +1578,10 @@
15571578 return treasure;
15581579 }
15591580
1581+ public int getMaxHaveBaby() {
1582+ return getDamageLimit()/300;
1583+ }
1584+
15601585 public static void loadShadowImages (ClassLoader loader) throws IOException {
15611586 final String path = "images/";
15621587
@@ -1687,6 +1712,14 @@
16871712 return (checkDamageState() == Damage.VERY);
16881713 }
16891714
1715+ public boolean isFeelPain() {
1716+ return (checkPainState() == Pain.VERY || checkPainState() == Pain.SOME);
1717+ }
1718+
1719+ public boolean isFeelHardPain() {
1720+ return (checkPainState() == Pain.VERY || checkPainState() == Pain.VERY);
1721+ }
1722+
16901723 public boolean isBirth() {
16911724 return (!dead && birth);
16921725 }
@@ -1776,6 +1809,10 @@
17761809 return (treasure == t);
17771810 }
17781811
1812+ public boolean isCantDie() {
1813+ return (cantDiePeriod > 0);
1814+ }
1815+
17791816 public boolean hasAccessory() {
17801817 return hasAccessory;
17811818 }
@@ -1784,6 +1821,14 @@
17841821 return hasPants;
17851822 }
17861823
1824+ public boolean hasManyBabies() {
1825+ return (getBabyTypes().size() > getMaxHaveBaby()/2 );
1826+ }
1827+
1828+ public boolean hasNearMaxNumBabies() {
1829+ return (getBabyTypes().size() > getMaxHaveBaby()/5*4 );
1830+ }
1831+
17871832 public boolean wantToShit() {
17881833 int step = (checkHungryState() == Hunger.NONE ? TICK*2 : TICK);
17891834 int adjust = 100*(isRude() ? 1 : 2)*shittingDiscipline;
@@ -2102,7 +2147,17 @@
21022147 }
21032148 }
21042149 /*---------------------------------------------------------------------------------------*/
2105-
2150+ public void bodyBurst() {
2151+ if (crashed == false) {
2152+ strike(HAMMER*20);
2153+ toDead();
2154+ }
2155+ if (dead) {
2156+ showDieing();
2157+ crashed = true;
2158+ }
2159+ }
2160+
21062161 public void kick() {
21072162 int blowLevel[] = {-4, -3, -2};
21082163 kick(0, blowLevel[ageState.ordinal()]*2, blowLevel[ageState.ordinal()]);
@@ -2237,7 +2292,29 @@
22372292 shitBoost += TICK;
22382293 }
22392294
2295+ @Override
2296+ public int getValue() {
2297+ return value[ageState.ordinal()];
2298+ }
22402299
2300+ public void setCantDie() {
2301+ cantDiePeriod = 3;
2302+ }
2303+
2304+ public void toDead(){
2305+ if ( !isCantDie() ) {
2306+ dead = true;
2307+ }
2308+ }
2309+
2310+ public void revival(){
2311+ if ( dead == true ) {
2312+ dead = false;
2313+ crashed = false;
2314+ giveJuice();
2315+ }
2316+ }
2317+
22412318 // calling every tick
22422319 @Override
22432320 public Obj.Event clockTick() {
@@ -2248,7 +2325,7 @@
22482325
22492326 // if partner and parents are removed, clean relationship.
22502327 clearRelation();
2251-
2328+
22522329 // if dead, do nothing.
22532330 if (dead) {
22542331 moveBody(true); // for falling the body
@@ -2261,10 +2338,12 @@
22612338 // check age
22622339 age += TICK;
22632340 if (age > LIFELIMIT) {
2264- dead = true;
2341+ toDead();
22652342 moveBody(true); // for falling the body
22662343 checkMessage();
2267- return Obj.Event.DEAD;
2344+ if (dead){
2345+ return Obj.Event.DEAD;
2346+ }
22682347 }
22692348 ageState = checkAgeState();
22702349
@@ -2272,6 +2351,7 @@
22722351 checkHungry();
22732352 checkDamage();
22742353 checkSick();
2354+ checkCantDie();
22752355
22762356 // check events
22772357 boolean dontMove = false;
@@ -2297,6 +2377,16 @@
22972377 retval = Obj.Event.BIRTHBABY;
22982378 }
22992379 }
2380+
2381+ if ( getBabyTypes().size() > getMaxHaveBaby() ){
2382+ toDead();
2383+ moveBody(true); // for falling the body
2384+ checkMessage();
2385+ if (dead){
2386+ bodyBurst();
2387+ return Obj.Event.DEAD;
2388+ }
2389+ }
23002390
23012391 // check sleep
23022392 if (checkSleep()) {
@@ -2380,6 +2470,9 @@
23802470 if (mama.isSick()) {
23812471 setSick();
23822472 }
2473+ if (mama.isDead()) {
2474+ damage+=DAMAGELIMIT[ageState.BABY.ordinal()]/4*3+rnd.nextInt(DAMAGELIMIT[ageState.BABY.ordinal()]);
2475+ }
23832476 showBirth();
23842477 }
23852478 }
Show on old repository browser