• R/O
  • SSH
  • HTTPS

simyukkuri: 提交


Commit MetaInfo

修订版10 (tree)
时间2012-08-24 22:03:31
作者mimisuke

Log Message

(empty log message)

更改概述

差异

--- tags/1.4/Reimu.java (nonexistent)
+++ tags/1.4/Reimu.java (revision 10)
@@ -0,0 +1,379 @@
1+public class Reimu extends Body {
2+ @Override
3+ protected void showWantFood() {
4+ switch (language) {
5+ case JAPANESE:
6+ String messagesJ[] = {"‚²‚Í‚ñ‚µ‚á‚ñ‚Ì‚É‚¨‚¢‚ª‚·‚è‚ã‚æ", "‚²‚Í‚ñ‚µ‚á‚ñ‚Ì‚É‚¨‚¢‚ª‚·‚è‚ã‚æ", "‚²‚Í‚ñ‚³‚ñ‚Ì‚É‚¨‚¢‚ª‚·‚é‚æ"};
7+ setMessage(messagesJ[ageState]);
8+ break;
9+ case ENGLISH:
10+ String messagesE[] = {"The shmell of mishder food!", "Shmell of mishder food!", "It's the smell of mister food!"};
11+ setMessage(messagesE[ageState]);
12+ break;
13+ }
14+ }
15+
16+ @Override
17+ public void showNoFood() {
18+ if (toFood == false) {
19+ return;
20+ }
21+ toFood = false;
22+ switch (language) {
23+ case JAPANESE:
24+ String messagesJ[][] = {{"‚²‚Í‚ñ‚µ‚á‚ñ‚É‚á‚¢‚æI", "‚²‚Í‚ñ‚µ‚á‚ñ‚É‚á‚¢‚æH‚΂«‚á‚Ȃ́H‚µ‚É‚ã‚́H", "‚²‚Í‚ñ‚³‚ñ‚È‚¢‚æH‚΂©‚Ȃ́H‚µ‚ʂ́H"},
25+ {"‚²‚Í‚ñ‚µ‚á‚ñ‚©‚¦‚¿‚āAAA", "‚²‚Í‚ñ‚µ‚á‚ñ‚©‚¦‚¿‚āAAA", "‚²‚Í‚ñ‚³‚ñ‚ª‚¦‚À‚Å‚®‚¾‚´‚¢‚¡AAA"}};
26+ setMessage(messagesJ[damageState][ageState]);
27+ break;
28+ case ENGLISH:
29+ String messagesE[][] = {{"Mishder food ish nod here!", "Mishder food ish nod here! Are you shtoopid? Wand choo die?", "Mister food is not here? Are you stupid? Want to die?"},
30+ {"Gib back mishder food...", "Gib back mishder food...", "Pwease give back mister food..."}};
31+ setMessage(messagesE[damageState][ageState]);
32+
33+ break;
34+ }
35+ stay();
36+ }
37+
38+ @Override
39+ protected void showExcite() {
40+ if (excitement) {
41+ switch (language) {
42+ case JAPANESE:
43+ setMessage("‚·‚Á‚¬‚肶‚¾‚¢‚́`I");
44+ break;
45+ case ENGLISH:
46+ setMessage("Want to refresh~!");
47+ break;
48+ }
49+ }
50+ }
51+
52+ @Override
53+ protected void showRelax() {
54+ if (rnd.nextInt(2) == 0) {
55+ switch (language) {
56+ case JAPANESE:
57+ String messagesJ[] = {"‚Ӂ[‚è‚Ӂ[‚è", "‚ê‚¢‚Ý‚ã‚©‚í‚¢‚«‚ã‚Ä‚²‚Ý‚¥‚ñ‚ˁI", "‚ê‚¢‚Þ‚Ì‚ ‚É‚á‚é‚Å‚µ‚±‚Á‚Ä‚à‚¢‚¢‚æI"};
58+ setMessage(messagesJ[ageState], 30);
59+ break;
60+ case ENGLISH:
61+ String messagesE[] = {"Relax-relax~", "Weimu ish showwy for being sho cude!", "Taste Reimu's anyaru is ok too!"};
62+ setMessage(messagesE[ageState], 30);
63+ break;
64+ }
65+ furifuri = true;
66+ stay(30);
67+ }
68+ else {
69+ switch (language) {
70+ case JAPANESE:
71+ String messagesJ[] = {"‚ä‚Á‚«‚ã‚肵‚Ä‚¢‚Á‚¿‚¥‚ˁI", "‚ä‚Á‚«‚ã‚肵‚Ä‚¢‚Á‚¿‚¥‚ˁI", "‚ä‚Á‚­‚肵‚Ä‚¢‚Á‚ĂˁI"};
72+ setMessage(messagesJ[ageState]);
73+ break;
74+ case ENGLISH:
75+ String messagesE[] = {"Chake id eajy!", "Chake id eajy!", "Take it easy!"};
76+ setMessage(messagesE[ageState]);
77+ break;
78+ }
79+ stay();
80+ }
81+ }
82+
83+ @Override
84+ protected void showWakeup() {
85+ switch (language) {
86+ case JAPANESE:
87+ String messagesJ[] = {"‚ä‚Á‚«‚ã‚肵‚Ä‚¢‚Á‚¿‚¥‚ˁI", "‚ä‚Á‚«‚ã‚肵‚Ä‚¢‚Á‚¿‚¥‚ˁI", "‚ä‚Á‚­‚肵‚Ä‚¢‚Á‚ĂˁI"};
88+ setMessage(messagesJ[ageState]);
89+ break;
90+ case ENGLISH:
91+ String messagesE[] = {"Chake id eajy!", "Chake id eajy!", "Take it easy!"};
92+ setMessage(messagesE[ageState]);
93+ break;
94+ }
95+ stay();
96+ }
97+
98+ @Override
99+ protected void showSleep() {
100+ if (sleep != 0) {
101+ switch (language) {
102+ case JAPANESE:
103+ setMessage("‚·[‚â‚·[‚â");
104+ break;
105+ case ENGLISH:
106+ setMessage("Sleep-Sleep---");
107+ break;
108+ }
109+ }
110+ }
111+
112+ @Override
113+ protected void showScream() {
114+ messageBuf = null;
115+ switch (language) {
116+ case JAPANESE:
117+ String messagesJ[][] = {{"‚ä‚ñ‚â[I", "‚¢‚¿‚á‚¢I‚Õ‚«‚ã[‚¶‚á‚æI", "‚¢‚½‚¢I‚Õ‚­[‚¾‚æI"},
118+ {"‚â‚ß‚¿‚¥‚É‚¥‚â‚ß‚¿‚¥‚É‚¥", "‚²‚ß‚ñ‚È‚¿‚á‚¢‚â‚ß‚¿‚¥‚É‚¥AAA", "‚Ç‚Ú‚¶‚Å‚Å‚¢‚Ô‚É‚±‚ñ‚È‚²‚Ç‚¸‚é‚Ì‚§AAA"}};
119+ setMessage(messagesJ[damageState][ageState]);
120+ break;
121+ case ENGLISH:
122+ String messagesE[][] = {{"YUNYA-!!", "ID HURD! Going choo pyuff-pyuff!", "It hurts! Puff!!"},
123+ {"Shdop id shdop id-", "Weimu ish showwy sho pwease shdop id...", "Why would you do thisss...."}};
124+ setMessage(messagesE[damageState][ageState]);
125+ break;
126+ }
127+ strike = true;
128+ stay();
129+ }
130+
131+ @Override
132+ protected void showDieing() {
133+ messageBuf = null;
134+ switch (language) {
135+ case JAPANESE:
136+ String messagesJ[] = {"‚ä‚ׂÁI", "‚Õ‚«‚ã‚ÁI", "‚°‚Ú‚ÁI"};
137+ setMessage(messagesJ[ageState]);
138+ break;
139+ case ENGLISH:
140+ String messagesE[] = {"Yubee!!", "Puff!", "Blarg!"};
141+ setMessage(messagesE[ageState]);
142+ break;
143+ }
144+ stay();
145+ }
146+
147+ @Override
148+ protected void showEating() {
149+ switch (language) {
150+ case JAPANESE:
151+ String messagesJ[][] = {{"‚ށ`‚¿‚á‚ށ`‚¿‚áA‚¿‚ ‚í‚¿‚¥[", "‚ށ[‚¿‚á‚ށ[‚¿‚áA‚¿‚ ‚í‚¿‚¥[", "‚ށ[‚µ‚á‚ށ[‚µ‚áA‚µ‚ ‚킹["},
152+ {"‚Þ‚Á‚¿‚á‚Þ‚Á‚¿‚áAAA", "‚Þ‚¿‚á‚Þ‚¿‚áA‚Í‚Ó‚Í‚Ó", "‚Þ‚Á‚µ‚á‚Þ‚Á‚µ‚áA‚¤‚ß‚¥"}};
153+ setMessage(messagesJ[hungryState][ageState]);
154+ break;
155+ case ENGLISH:
156+ String messagesE[][] = {{"Myunch-Myunch, happinesh~ ", "Myunch~ Myunch~ Happinesh~", "Munch munch, Happiness"},
157+ {"Myunch myunch...", "Myunch Myunch, nom nom", "Munch munch, so good!"}};
158+ setMessage(messagesE[hungryState][ageState]);
159+ break;
160+ }
161+ eating = true;
162+ stay();
163+ }
164+
165+ @Override
166+ protected void showFull() {
167+ switch (language) {
168+ case JAPANESE:
169+ String messagesJ[] = {"‚¨‚É‚á‚©‚¢‚Á‚Ï‚¢AAA", "‚¨‚É‚á‚©‚¢‚Á‚Ï‚¢AAA", "‚à‚¤‚½‚ׂç‚ê‚È‚¢‚́AAA"};
170+ setMessage(messagesJ[ageState]);
171+ break;
172+ case ENGLISH:
173+ String messagesE[] = {"Tummy ish full...", "Tummy ish full...", "Can't eat anymore..."};
174+ setMessage(messagesE[ageState]);
175+ break;
176+ }
177+ stay();
178+ }
179+
180+ @Override
181+ protected void showHealing() {
182+ switch (language) {
183+ case JAPANESE:
184+ String messagesJ[][] = {{"‚ ‚Ý‚ã‚ ‚Ý‚áI", "‚ä‚Á‚«‚ã‚¿‚µ‚¿‚á‚æI", "‚ä‚Á‚­‚肵‚½‚æI"},
185+ {"‚ ‚Ý‚á‚ ‚Ý‚á", "‚ä‚Á‚«‚ã‚¿‚µ‚¿‚á‚æ", "‚ä‚Á‚­‚肵‚½‚æ"}};
186+ setMessage(messagesJ[damageState][ageState]);
187+ break;
188+ case ENGLISH:
189+ String messagesE[][] = {{"Shweet-shweet!", "Eajy!", "Can take it easy!"},
190+ {"Shweet-shweet", "Can chake id eajy", "Can take it easy"}};
191+ setMessage(messagesE[damageState][ageState]);
192+ break;
193+ }
194+ stay();
195+ }
196+
197+ @Override
198+ protected void showSukkiri() {
199+ switch (language) {
200+ case JAPANESE:
201+ String messagesJ[] = {"‚¿‚ã‚Á‚«‚¿I", "‚¿‚ã‚Á‚«‚èI", "‚·‚Á‚«‚èI"};
202+ setMessage(messagesJ[ageState], 30);
203+ break;
204+ case ENGLISH:
205+ String messagesE[] = {"Wefweshed!", "Wefeshed!", "Refreshed!"};
206+ setMessage(messagesE[ageState], 30);
207+ break;
208+ }
209+ sukkiri = true;
210+ stay(30);
211+ }
212+
213+ @Override
214+ protected void showBirth() {
215+ switch (language) {
216+ case JAPANESE:
217+ setMessage("‚ä‚Á‚­‚¿‚¿‚Ä‚¢‚Á‚¿‚¥‚ˁI", 30);
218+ break;
219+ case ENGLISH:
220+ setMessage("Chake id eajy!", 30);
221+ break;
222+ }
223+ stay(30);
224+ }
225+
226+ @Override
227+ protected void showShit() {
228+ switch (language) {
229+ case JAPANESE:
230+ String messagesJ[] = {"‚¤‚ñ‚¤‚ñ‚À‚¥‚è‚ãI", "‚è‚¥‚¢‚Ý‚ã‚Ì‚·[‚Ò‚á[‚¤‚ñ‚¤‚ñ‚¿‚á‚¢‚Ý‚ã‚Í‚À‚Ý‚á‚è‚ã‚É‚åI", "‚ê‚¢‚Þ‚Ì‚·[‚ρ[‚¤‚ñ‚¤‚ñ‚½‚¢‚Þ‚Í‚¶‚Ü‚é‚æI"};
231+ setMessage(messagesJ[ageState]);
232+ break;
233+ case ENGLISH:
234+ String messagesE[] = {"Poo-pooing!", "Weimu's shuupa poo-poo time ish shtarting!", "Reimu's super poo-poo time is starting!"};
235+ setMessage(messagesE[ageState]);
236+ break;
237+ }
238+ }
239+
240+ @Override
241+ protected void showShit2() {
242+ switch (language) {
243+ case JAPANESE:
244+ String messagesJ[] = {"‚·‚Á‚«‚¿I", "‚·‚Á‚«‚¿[I", "‚·‚Á‚«‚è[I"};
245+ setMessage(messagesJ[ageState]);
246+ break;
247+ case ENGLISH:
248+ String messagesE[] = {"Wefeshed!", "Wefeshed-!!", "Refreshed~!"};
249+ setMessage(messagesE[ageState]);
250+ break;
251+ }
252+ furifuri = true;
253+ stay();
254+ }
255+
256+ @Override
257+ protected void showSurisuri() {
258+ switch (language) {
259+ case JAPANESE:
260+ String messagesJ[] = {"‚¿‚ã‚è‚¿‚ã‚è", "‚¿‚ã[‚è‚¿‚ã[‚è", "‚·[‚è‚·[‚è"};
261+ setMessage(messagesJ[ageState]);
262+ break;
263+ case ENGLISH:
264+ String messagesE[] = {"Wub-wub", "Wub-wub", "Rub-rub"};
265+ setMessage(messagesE[ageState]);
266+ break;
267+ }
268+ stay();
269+ }
270+
271+ @Override
272+ protected void showPeroPero() {
273+ switch (language) {
274+ case JAPANESE:
275+ String messagesJ[] = {"‚Ø‚è‚å‚Ø‚è‚å", "‚؁[‚è‚å‚؁[‚è‚å", "‚؁[‚ë‚؁[‚ë"};
276+ setMessage(messagesJ[ageState]);
277+ break;
278+ case ENGLISH:
279+ String messagesE[] = {"Wick-wick~", "Wick-wick~", "Lick-lick~"};
280+ setMessage(messagesE[ageState]);
281+ break;
282+ }
283+ peropero = true;
284+ stay();
285+ }
286+
287+ @Override
288+ protected void showBreed() {
289+ switch (language) {
290+ case JAPANESE:
291+ setMessage("‚¤A‚¤‚΂ê‚éAAA");
292+ break;
293+ case ENGLISH:
294+ setMessage("B...Being born...");
295+ break;
296+ }
297+ }
298+
299+ @Override
300+ protected void showBreed2() {
301+ messageBuf = null;
302+ switch (language) {
303+ case JAPANESE:
304+ setMessage("‚ä‚Á‚­‚肵‚Ä‚¢‚Á‚ĂˁI");
305+ break;
306+ case ENGLISH:
307+ setMessage("Take it easy!");
308+ break;
309+ }
310+ furifuri = true;
311+ stay();
312+ }
313+
314+ @Override
315+ public void showHateShit() {
316+ switch (language) {
317+ case JAPANESE:
318+ String messagesJ[][] = {{"‚­‚¿‚á‚¢I", "‚¤‚ñ‚¤‚ñ‚­‚¿‚á‚¢I‚µ‚ガ‚ã‚É‚©‚½‚¶‚ã‚«‚¥‚è‚åI", "‚¤‚ñ‚¤‚ñ‚©‚½‚¯‚ĂˁI‚·‚®‚Å‚¢‚¢‚æI"},
319+ {"‚­‚¿‚á‚¢AAA", "‚­‚¿‚á‚¢‚æA‚ä‚Á‚«‚ã‚è‚Å‚«‚É‚á‚¢AAA", "‚­‚³‚¢‚æA‚ä‚Á‚­‚è‚Å‚«‚È‚¢‚æAAA"}};
320+ setMessage(messagesJ[damageState][ageState]);
321+ break;
322+ case ENGLISH:
323+ String messagesE[][] = {{"Shmelly~!", "Poo-poo shdinky!! Help eajy!!", "Hurry up and save me from poo-poo!! Right now is fine!"},
324+ {"Shmelly...", "Shmelly, can'ch chake id eajy...", "Smelly... can't take it easy..."}};
325+ setMessage(messagesE[damageState][ageState]);
326+ break;
327+ }
328+ }
329+
330+ @Override
331+ protected void showHungry() {
332+ switch (language) {
333+ case JAPANESE:
334+ String messagesJ[][] = {{"‚ ‚Ý‚á‚ ‚Ý‚á‚¿‚傤‚¶‚á‚¢I", "‚²‚Í‚ñ‚µ‚á‚ñ‚ð‚ê‚¢‚Ý‚ã‚É‚à‚Á‚Ä‚«‚¿‚¥‚ˁI", "‚²‚Í‚ñ‚³‚ñ‚ð‚ê‚¢‚Þ‚É‚¿‚傤‚¾‚¢‚ˁI‚½‚­‚³‚ñ‚Å‚¢‚¢‚æI"},
335+ {"‚²‚Í‚ñ‚µ‚á‚ñ‚Ç‚«‚åH", "‚¨‚É‚á‚«‚á‚Ö‚Á‚¿‚á‚æAAA", "‚Å‚¢‚Ô‚É‚²‚Í‚ñ‚®‚¾‚´‚¢‚¡"}};
336+ setMessage(messagesJ[damageState][ageState]);
337+ break;
338+ case ENGLISH:
339+ String messagesE[][] = {{"Gib up shweet-shweets!", "Bwing mishder munch-munch choo Weimu!", "Bring the munch-munch to Reimu! A lot is fine!"},
340+ {"Where ish mishder food?", "Misder tummy ish hungwy...", "Pwease give Deibu some food..."}};
341+ setMessage(messagesE[damageState][ageState]);
342+ break;
343+ }
344+ stay();
345+ }
346+
347+ @Override
348+ protected void showNoAccessory() {
349+ switch (language) {
350+ case JAPANESE:
351+ String messagesJ[] = {"‚ä‚¥[‚ñI‚¨‚è‚Ú‚ñ‚µ‚á‚ñ‚Ç‚«‚åH", "‚ä‚¥[‚ñI‚è‚¥‚¢‚Ý‚ã‚Ì‚«‚á‚í‚¢‚¢‚¨‚è‚Ú‚ñ‚µ‚á‚ñ‚Ç‚±H", "‚ê‚¢‚Þ‚Ì‚¨‚è‚Ú‚ñ‚³‚ñ‚Ç‚±H"};
352+ setMessage(messagesJ[ageState]);
353+ break;
354+ case ENGLISH:
355+ String messagesE[] = {"Yunn~! Where ish misder Wibbon?", "Yunn~! Where ish Weimu's cude-cude misder Wibbon?", "Where's Reimu's mister ribbon?"};
356+ setMessage(messagesE[ageState]);
357+ break;
358+ }
359+ }
360+
361+ @Override
362+ public void showHateYukkuri() {
363+ switch (language) {
364+ case JAPANESE:
365+ String messagesJ[] = {"‚ä‚Á‚­‚¿‚Å‚«‚É‚á‚¢‚ä‚Á‚­‚¿‚ª‚¢‚è‚ã‚æ", "‚ä‚Á‚­‚¿‚Å‚«‚É‚á‚¢‚ä‚Á‚­‚¿‚ª‚¢‚è‚ã‚æ", "‚ä‚Á‚­‚è‚Å‚«‚È‚¢‚ä‚Á‚­‚肪‚¢‚é‚æI‚¹‚¢‚Á‚³‚¢‚·‚é‚æI"};
366+ setMessage(messagesJ[ageState]);
367+ break;
368+ case ENGLISH:
369+ String messagesE[] = {"There'sh a yukkuri that can'ch chake id eajy", "There'sh a yukkuri that can'ch chake id eajy", "A yukkuri that can't take it easy! Punishment time!"};
370+ setMessage(messagesE[ageState]);
371+ break;
372+ }
373+ }
374+
375+ // public methods
376+ public Reimu(int initX, int initY, int initAgeState) {
377+ super(initX, initY, Body.REIMU, initAgeState);
378+ }
379+}
--- tags/1.4/Yukkuri.java (nonexistent)
+++ tags/1.4/Yukkuri.java (revision 10)
@@ -0,0 +1,227 @@
1+import java.util.*;
2+
3+public class Yukkuri {
4+ public static ArrayList<Body> bodyList = new ArrayList<Body>();
5+ public static ArrayList<Food> foodList = new ArrayList<Food>();
6+ public static ArrayList<Shit> shitList = new ArrayList<Shit>();
7+
8+ private Random rnd = new Random();
9+ private int language = Body.JAPANESE;
10+
11+ private int distance(int x, int y) {
12+ return x*x + y*y;
13+ }
14+
15+ private boolean checkPartner(Body b) {
16+ if (b.isDead() || b.isSleeping()) {
17+ return false;
18+ }
19+ boolean ret = false;
20+ Body found = null;
21+ int minDistance = Box.maxX * Box.maxY;
22+ // find nearest neighborhood
23+ for (Body partner:bodyList) {
24+ if (partner == b) {
25+ continue;
26+ }
27+ if (partner.isDead() || (b.isExciting() && !partner.isAdult())) {
28+ continue;
29+ }
30+ int dist, dx, dy;
31+ dx = b.getX() - partner.getX();
32+ dy = b.getY() - partner.getY();
33+ dist = distance(dx, dy);
34+ if (minDistance > dist) {
35+ found = partner;
36+ minDistance = dist;
37+ }
38+ }
39+ if (found != null) {
40+ if (minDistance <= distance(b.getStep(), b.getStep())) {
41+ if (b.isExciting()) {
42+ b.doSukkiri(found);
43+ }
44+ else if (!found.isAccessory()) {
45+ b.showHateYukkuri();
46+ found.strikeByNeedle();
47+ }
48+ else if (rnd.nextInt(20) == 0) {
49+ b.doSurisuri(found);
50+ }
51+ }
52+ else {
53+ if (b.isExciting()) {
54+ b.moveToSukkiri(found.getX(), found.getY());
55+ ret = true;
56+ }
57+ else if (!found.isAccessory() && rnd.nextInt(10) == 0) {
58+ b.showHateYukkuri();
59+ b.moveTo(found.getX(), found.getY());
60+ }
61+ else if (!b.isAdult() && found.isAdult()) {
62+ b.moveTo(found.getX(), found.getY());
63+ }
64+ }
65+ }
66+ return ret;
67+ }
68+
69+ private boolean checkFood(Body b) {
70+ boolean ret = false;
71+ if (b.isSleeping() || b.isDead() || !b.isHungry()) {
72+ return false;
73+ }
74+ Food found = null;
75+ int minDistance = Box.maxX * Box.maxY;
76+ for (Food f:foodList) {
77+ if (f.isEmpty()) {
78+ continue;
79+ }
80+ int distance, dx, dy;
81+ dx = b.getX() - f.getX();
82+ dy = b.getY() - f.getY();
83+ distance = distance(dx, dy);
84+ if (minDistance > distance) {
85+ found = f;
86+ minDistance = distance;
87+ }
88+ }
89+ if (found != null) {
90+ if (minDistance <= distance(b.getStep(), b.getStep())) {
91+ b.eatFood(b.getEatAmount());
92+ found.eatFood(b.getEatAmount());
93+ } else {
94+ // go to nearest food
95+ b.moveToFood(found.getX(), found.getY());
96+ ret = true;
97+ }
98+ }
99+ else {
100+ b.showNoFood();
101+ }
102+ return ret;
103+ }
104+
105+ private boolean checkShit(Body b) {
106+ boolean ret = false;
107+ Shit found = null;
108+ int minDistance = Box.maxX * Box.maxY;
109+ for (Shit s:shitList) {
110+ int distance, dx, dy;
111+ dx = b.getX() - s.getX();
112+ dy = b.getY() - s.getY();
113+ distance = distance(dx, dy);
114+ if (minDistance > distance) {
115+ found = s;
116+ minDistance = distance;
117+ }
118+ }
119+ if (found != null) {
120+ if (minDistance <= distance(b.getStep(), b.getStep())) {
121+ if (!b.isSleeping() && !b.isExciting()) {
122+ b.showHateShit();
123+ }
124+ }
125+ }
126+ return ret;
127+ }
128+
129+ public void addBody(int x, int y, int type, int age) {
130+ switch (type) {
131+ case Body.MARISA:
132+ bodyList.add(new Marisa(x, y, age));
133+ break;
134+ case Body.REIMU:
135+ bodyList.add(new Reimu(x, y, age));
136+ break;
137+ }
138+ }
139+
140+ public void addFood(int x, int y, int type) {
141+ foodList.add(new Food(x, y, type));
142+ }
143+
144+ public void addYukkuriFood(int x, int y) {
145+ addFood(x, y, Food.YUKKURIFOOD);
146+ }
147+
148+ public void addCake(int x, int y) {
149+ addFood(x, y, Food.CAKE);
150+ }
151+
152+ public void addShit(int x, int y, int ageState) {
153+ shitList.add(new Shit(x, y, ageState));
154+ }
155+
156+ public void setLanguage(int lang) {
157+ switch (lang) {
158+ case 0:
159+ language = Body.JAPANESE;
160+ break;
161+ case 1:
162+ language = Body.ENGLISH;
163+ break;
164+ }
165+ }
166+
167+ public int fontWidth() {
168+ int width = 13;
169+ switch (language) {
170+ case Body.JAPANESE:
171+ width = 13;
172+ break;
173+ case Body.ENGLISH:
174+ width = 7;
175+ break;
176+ }
177+ return width;
178+ }
179+
180+ public void run() {
181+ int ret = 0;
182+ // Update food state.
183+ for (int i=0; i < foodList.size(); i++) {
184+ Food f = (Food)foodList.get(i);
185+ ret = f.clockTick();
186+ if (ret == Food.REMOVED) {
187+ foodList.remove(i);
188+ }
189+ }
190+ // Update shit state.
191+ for (int i=0; i < shitList.size(); i++) {
192+ Shit s = (Shit)shitList.get(i);
193+ ret = s.clockTick();
194+ if (ret == Shit.REMOVED) {
195+ shitList.remove(i);
196+ }
197+ }
198+ // update body state
199+ for (int i=0; i < bodyList.size(); i++) {
200+ Body b = (Body)bodyList.get(i);
201+ b.setLanguage(language);
202+ ret = b.clockTick();
203+ switch (ret) {
204+ case Body.DEAD:
205+ continue;
206+ case Body.BIRTHBABY:
207+ addBody(b.getX(), b.getY(), b.getBabyType(), 0);
208+ break;
209+ case Body.DOSHIT:
210+ addShit(b.getX(), b.getY(), b.getAgeState());
211+ break;
212+ case Body.REMOVED:
213+ bodyList.remove(i);
214+ continue;
215+ default:
216+ break;
217+ }
218+
219+ // check Sukkiri
220+ if (!checkPartner(b)) {
221+ // check Food
222+ checkFood(b);
223+ checkShit(b);
224+ }
225+ }
226+ }
227+}
\ No newline at end of file
--- tags/1.4/Shit.java (nonexistent)
+++ tags/1.4/Shit.java (revision 10)
@@ -0,0 +1,27 @@
1+public class Shit extends Obj {
2+ private static final int SHITLIMIT[] = {100*12, 100*24, 100*24*2};
3+ private int ageState;
4+
5+ public Shit (int initX, int initY, int initAgeState) {
6+ objType = SHIT;
7+ x = initX;
8+ y = initY;
9+ ageState = initAgeState;
10+ removed = false;
11+ }
12+
13+ public int getAgeState() {
14+ return ageState;
15+ }
16+
17+ public int clockTick() {
18+ if (removed == false) {
19+ age += TICK;
20+ if (age >= SHITLIMIT[ageState]) {
21+ removed = true;
22+ }
23+ return DONOTHING;
24+ }
25+ return REMOVED;
26+ }
27+}
\ No newline at end of file
--- tags/1.4/Obj.java (nonexistent)
+++ tags/1.4/Obj.java (revision 10)
@@ -0,0 +1,49 @@
1+public class Obj {
2+ // Object type
3+ public static final int YUKKURI = 1;
4+ public static final int SHIT = 2;
5+ public static final int FOOD = 3;
6+
7+ // Object event
8+ public static final int BIRTHBABY = 1;
9+ public static final int DOSHIT = 2;
10+ public static final int DEAD = 3;
11+ public static final int REMOVED = 4;
12+ public static final int DONOTHING = 5;
13+
14+ public static final int TICK = 1;
15+
16+ // basic attributes
17+ protected long age; //age of this object
18+ protected int x, y, z; //location
19+ protected int objType; //YUKKURI, SHIT, FOOD
20+ protected boolean removed = false;
21+
22+ public int getX() {
23+ return x;
24+ }
25+
26+ public int getY() {
27+ return y;
28+ }
29+
30+ public int getZ() {
31+ return z;
32+ }
33+
34+ public int getObjType() {
35+ return objType;
36+ }
37+
38+ public void remove() {
39+ removed = true;
40+ }
41+
42+ public int clockTick() {
43+ age += TICK;
44+ if (removed == true) {
45+ return REMOVED;
46+ }
47+ return DONOTHING;
48+ }
49+}
\ No newline at end of file
--- tags/1.4/SimYukkuri.java (nonexistent)
+++ tags/1.4/SimYukkuri.java (revision 10)
@@ -0,0 +1,404 @@
1+import java.awt.*;
2+import java.awt.event.*;
3+import javax.swing.*;
4+import javax.swing.border.*;
5+import java.io.*;
6+import javax.imageio.*;
7+import java.util.ArrayList;
8+import java.util.Collections;
9+import java.util.Comparator;
10+import java.util.List;
11+
12+public class SimYukkuri extends JFrame implements ActionListener {
13+ JPanel rootPane = new JPanel();
14+ JPanel buttonPane = new JPanel();
15+ JComboBox s1, s2;
16+ JLabel l1, l2;
17+ static myPane mypane = new myPane();
18+ static Thread mythread;
19+
20+ public SimYukkuri() {
21+ super("‚µ‚Þ‚ä‚Á‚­‚è");
22+ // setup button pane
23+ buttonPane.setLayout(new GridLayout(20, 1));
24+ buttonPane.setBorder(new LineBorder(Color.gray, 2));
25+ JLabel title = new JLabel("‚µ‚Þ‚ä‚Á‚­‚è Ver1.4@");
26+ buttonPane.add(title);
27+ l1 = new JLabel("“¹‹ï/Tools");
28+ buttonPane.add(l1);
29+ String[] list1 = {"j", "ƒnƒ“ƒ}[", "ƒoƒCƒu", "ƒWƒ…[ƒX", "‚¦‚³", "ƒzƒEƒL", "‚¨‚©‚´‚è"};
30+ s1 = new JComboBox(list1);
31+ buttonPane.add(s1);
32+ JLabel l2 = new JLabel("Œ¾Œê/Language");
33+ buttonPane.add(l2);
34+ String[] list2 = {"“ú–{Œê", "‰pŒê"};
35+ s2 = new JComboBox(list2);
36+ s2.addActionListener(this);
37+ buttonPane.add(s2);
38+ // setup my pane
39+ mypane.addMouseListener(new myListener());
40+ // setup root pane
41+ rootPane.setLayout(new BorderLayout());
42+ rootPane.add("Center", mypane);
43+ rootPane.add("East", buttonPane);
44+ // setup my frame
45+ setSize(1024, 600);
46+ setDefaultCloseOperation(EXIT_ON_CLOSE);
47+ setLocation(new Point(100, 100));
48+ setContentPane(rootPane);
49+ setResizable(false);
50+ setVisible(true);
51+ }
52+
53+ public static void main(String[] args) {
54+ SimYukkuri myyukkuri = new SimYukkuri();
55+ mypane.isRunning = true;
56+ mythread = new Thread(mypane);
57+ mythread.start();
58+ }
59+
60+ public void actionPerformed(ActionEvent e) {
61+ switch (s2.getSelectedIndex()) {
62+ case 0:
63+ mypane.yukkuri.setLanguage(Body.JAPANESE);
64+ s1.removeAllItems();
65+ s1.addItem("j");
66+ s1.addItem("ƒnƒ“ƒ}[");
67+ s1.addItem("ƒoƒCƒu");
68+ s1.addItem("ƒWƒ…[ƒX");
69+ s1.addItem("‚¦‚³");
70+ s1.addItem("ƒzƒEƒL");
71+ s1.addItem("‚¨‚©‚´‚è");
72+ s2.removeAllItems();
73+ s2.addItem("“ú–{Œê");
74+ s2.addItem("‰pŒê");
75+ s2.setSelectedIndex(0);
76+ break;
77+ case 1:
78+ mypane.yukkuri.setLanguage(Body.ENGLISH);
79+ s1.removeAllItems();
80+ s1.addItem("Needle");
81+ s1.addItem("Hammer");
82+ s1.addItem("Vibrator");
83+ s1.addItem("Juice");
84+ s1.addItem("Food");
85+ s1.addItem("Sweep");
86+ s1.addItem("Accessory");
87+ s2.removeAllItems();
88+ s2.addItem("Japanese");
89+ s2.addItem("English");
90+ s2.setSelectedIndex(1);
91+ break;
92+ }
93+ }
94+
95+ public class myListener extends MouseAdapter {
96+ public void mouseClicked(MouseEvent e){
97+ Point p = e.getPoint();
98+ Dimension size = mypane.getSize();
99+ int w = size.width, h = size.height;
100+ boolean hit = false;
101+ if (s1.getSelectedIndex() == 5) {//ƒzƒEƒL
102+ for (Shit s:Yukkuri.shitList) {
103+ int ageState = s.getAgeState();
104+ int dia[] = {10, 20, 30};
105+ int offsetX = (myPane.maxSize - dia[ageState])/2;
106+ int offsetY = (myPane.maxSize - dia[ageState]);
107+ int dx = (int)p.getX() - (Translate.transX(s.getX(), s.getY(), Box.maxX, Box.maxY)*(w-myPane.maxSize)/Box.maxX + offsetX);
108+ int dy = (int)p.getY() - (Translate.transY(s.getX(), s.getY(), Box.maxX, Box.maxY)*(h-myPane.maxSize)/Box.maxY + offsetY);
109+ if (dx >= 0 && dx <= dia[ageState] && dy >= 0 && dy <= dia[ageState]) {
110+ s.remove();
111+ hit = true;
112+ }
113+ }
114+ for (Food f:Yukkuri.foodList) {
115+ int offsetX = (myPane.maxSize - myPane.foodSize)/2;
116+ int offsetY = (myPane.maxSize - myPane.foodSize/2);
117+ int dx = (int)p.getX() - (Translate.transX(f.getX(), f.getY(), Box.maxX, Box.maxY)*(w-myPane.maxSize)/Box.maxX + offsetX);
118+ int dy = (int)p.getY() - (Translate.transY(f.getX(), f.getY(), Box.maxX, Box.maxY)*(h-myPane.maxSize)/Box.maxY + offsetY);
119+ if (dx >= 0 && dx <= myPane.foodSize && dy >= 0 && dy <= myPane.foodSize/2) {
120+ f.remove();
121+ hit = true;
122+ }
123+ }
124+ }
125+ for (Body b:Yukkuri.bodyList) {
126+ int ageState = b.getAgeState();
127+ int dia[] = {myPane.maxSize/4, myPane.maxSize/2, myPane.maxSize};
128+ int offsetX = (myPane.maxSize - dia[ageState])/2;
129+ int offsetY = (myPane.maxSize - dia[ageState]);
130+ int dx = (int)p.getX() - (Translate.transX(b.getX(), b.getY(), Box.maxX, Box.maxY)*(w-myPane.maxSize)/Box.maxX + offsetX);
131+ int dy = (int)p.getY() - (Translate.transY(b.getX(), b.getY(), Box.maxX, Box.maxY)*(h-myPane.maxSize)/Box.maxY + offsetY);
132+ if (dx >= 0 && dx <= dia[ageState] && dy >= 0 && dy <= dia[ageState]) {
133+ switch (s1.getSelectedIndex()) {
134+ case 0:
135+ //j
136+ b.strikeByNeedle();
137+ break;
138+ case 1:
139+ //ƒnƒ“ƒ}[
140+ b.strikeByHammer();
141+ break;
142+ case 2:
143+ //ƒoƒCƒu
144+ b.forceSukkiri();
145+ break;
146+ case 3:
147+ //ƒWƒ…[ƒX
148+ b.giveJuice();
149+ break;
150+ case 4:
151+ //‚¦‚³
152+ break;
153+ case 5:
154+ //ƒzƒEƒL
155+ if (b.isDead()) {
156+ b.remove();
157+ }
158+ break;
159+ case 6:
160+ //‚¨‚©‚´‚è
161+ if (b.isAccessory()) {
162+ b.takeAccessory();
163+ }
164+ else {
165+ b.giveAccessory();
166+ }
167+ break;
168+ default:
169+ System.out.println("invalid tool");
170+ }
171+ hit = true;
172+ }
173+ }
174+ if (!hit && s1.getSelectedIndex() == 4) { //‚¦‚³
175+ int offsetX = (myPane.maxSize - mypane.foodSize)/2;
176+ int offsetY = (myPane.maxSize - myPane.foodSize/2);
177+ int X = ((int)p.getX() - offsetX)*Box.maxX/(w-myPane.maxSize);
178+ int Y = ((int)p.getY() - offsetY)*Box.maxY/(h-myPane.maxSize);
179+ int x = Translate.invX(X, Y, Box.maxX, Box.maxY);
180+ int y = Translate.invY(X, Y, Box.maxX, Box.maxY);
181+ if (x >= 0 && x <= Box.maxX && y >= 0 && y <= Box.maxY) {
182+ //‚ä‚Á‚­‚èƒt[ƒh
183+ mypane.yukkuri.addYukkuriFood(x, y);
184+ }
185+ }
186+ }
187+ }
188+}
189+
190+class myPane extends JPanel implements Runnable {
191+ public boolean isRunning = false;
192+ public Yukkuri yukkuri = new Yukkuri();
193+ public static final int maxSize = 128; // max size of icons
194+ public static final int foodSize = 64; // size of food
195+ private Image[][] bodyImage = new Image[3][15];
196+ private Image[] foodImage = new Image[2];
197+ private Image shitImage;
198+ private Image shadowImage;
199+ private Image backGroundImage;
200+ private List <Obj>list4sort = new ArrayList<Obj>();
201+ private int jump[] = {0, 8, 12, 14, 15, 14, 12, 8, 0};
202+
203+ public void run() {
204+ //load images
205+ try {
206+ ClassLoader loader = this.getClass().getClassLoader();
207+ bodyImage[1][0] = ImageIO.read(loader.getResourceAsStream("images/marisa1.png"));
208+ bodyImage[1][1] = ImageIO.read(loader.getResourceAsStream("images/marisa2.png"));
209+ bodyImage[1][2] = ImageIO.read(loader.getResourceAsStream("images/marisa3.png"));
210+ bodyImage[1][3] = ImageIO.read(loader.getResourceAsStream("images/marisa4.png"));
211+ bodyImage[1][4] = ImageIO.read(loader.getResourceAsStream("images/marisa5.png"));
212+ bodyImage[1][5] = ImageIO.read(loader.getResourceAsStream("images/marisa6.png"));
213+ bodyImage[1][6] = ImageIO.read(loader.getResourceAsStream("images/marisa7.png"));
214+ bodyImage[1][7] = ImageIO.read(loader.getResourceAsStream("images/marisa8.png"));
215+ bodyImage[1][8] = ImageIO.read(loader.getResourceAsStream("images/marisa9.png"));
216+ bodyImage[1][9] = ImageIO.read(loader.getResourceAsStream("images/marisa10.png"));
217+ bodyImage[1][10] = ImageIO.read(loader.getResourceAsStream("images/marisa11.png"));
218+ bodyImage[1][11] = ImageIO.read(loader.getResourceAsStream("images/marisa2-1.png"));
219+ bodyImage[1][12] = ImageIO.read(loader.getResourceAsStream("images/marisa2-2.png"));
220+ bodyImage[1][13] = ImageIO.read(loader.getResourceAsStream("images/marisa1-2.png"));
221+ bodyImage[1][14] = ImageIO.read(loader.getResourceAsStream("images/marisa3-2.png"));
222+ bodyImage[2][0] = ImageIO.read(loader.getResourceAsStream("images/reimu1.png"));
223+ bodyImage[2][1] = ImageIO.read(loader.getResourceAsStream("images/reimu2.png"));
224+ bodyImage[2][2] = ImageIO.read(loader.getResourceAsStream("images/reimu3.png"));
225+ bodyImage[2][3] = ImageIO.read(loader.getResourceAsStream("images/reimu4.png"));
226+ bodyImage[2][4] = ImageIO.read(loader.getResourceAsStream("images/reimu5.png"));
227+ bodyImage[2][5] = ImageIO.read(loader.getResourceAsStream("images/reimu6.png"));
228+ bodyImage[2][6] = ImageIO.read(loader.getResourceAsStream("images/reimu7.png"));
229+ bodyImage[2][7] = ImageIO.read(loader.getResourceAsStream("images/reimu8.png"));
230+ bodyImage[2][8] = ImageIO.read(loader.getResourceAsStream("images/reimu9.png"));
231+ bodyImage[2][9] = ImageIO.read(loader.getResourceAsStream("images/reimu10.png"));
232+ bodyImage[2][10] = ImageIO.read(loader.getResourceAsStream("images/reimu11.png"));
233+ bodyImage[2][11] = ImageIO.read(loader.getResourceAsStream("images/reimu2-1.png"));
234+ bodyImage[2][12] = ImageIO.read(loader.getResourceAsStream("images/reimu2-2.png"));
235+ bodyImage[2][13] = ImageIO.read(loader.getResourceAsStream("images/reimu1-2.png"));
236+ bodyImage[2][14] = ImageIO.read(loader.getResourceAsStream("images/reimu3-2.png"));
237+ foodImage[0] = ImageIO.read(loader.getResourceAsStream("images/gohan1.png"));
238+ foodImage[1] = ImageIO.read(loader.getResourceAsStream("images/gohan2.png"));
239+ shitImage = ImageIO.read(loader.getResourceAsStream("images/unun.png"));
240+ shadowImage = ImageIO.read(loader.getResourceAsStream("images/shadow.png"));
241+ backGroundImage = ImageIO.read(loader.getResourceAsStream("images/back.jpg"));
242+ } catch (IOException e1) {System.out.println("File I/O error");}
243+ // make initial bodies
244+ yukkuri.addBody(10, 20, Body.MARISA, Body.ADULT);
245+ yukkuri.addBody(120, 20, Body.REIMU, Body.ADULT);
246+ // run animation
247+ while (isRunning) {
248+ yukkuri.run();
249+ repaint();
250+ try {
251+ Thread.sleep(100);
252+ } catch (InterruptedException e2) {e2.printStackTrace();}
253+ }
254+ }
255+
256+ public void paint(Graphics g) {
257+ list4sort.clear();
258+ list4sort.addAll(Yukkuri.bodyList);
259+ list4sort.addAll(Yukkuri.foodList);
260+ list4sort.addAll(Yukkuri.shitList);
261+ Collections.sort(list4sort, new objComparator());
262+ Dimension size = getSize();
263+ int w = size.width, h = size.height;
264+ g.drawImage(backGroundImage, 0, 0, w, h, this);
265+ for (Obj o : list4sort) {
266+ switch (o.objType) {
267+ case Obj.YUKKURI: {
268+ Body b = (Body)o;
269+ int ageState = b.getAgeState();
270+ int dia[] = {maxSize/4, maxSize/2, maxSize};
271+ int offsetX = (maxSize - dia[ageState])/2;
272+ int offsetY = (maxSize - dia[ageState]);
273+ int drX = Translate.transX(b.getX(), b.getY(), Box.maxX, Box.maxY)*(w-maxSize)/Box.maxX + offsetX;
274+ int drY = Translate.transY(b.getX(), b.getY(), Box.maxX, Box.maxY)*(h-maxSize)/Box.maxY + offsetY;
275+ int jumpLevel[] = {4, 2, 1};
276+ // draw face
277+ g.drawImage(shadowImage, drX, drY, dia[ageState], dia[ageState], this);
278+ if (!b.isAccessory()) {
279+ if (b.isDead()) {
280+ g.drawImage(bodyImage[b.getBodyType()][10], drX, drY, dia[ageState], dia[ageState], this);
281+ }
282+ else if (b.isDamaged()) {
283+ g.drawImage(bodyImage[b.getBodyType()][9], drX, drY, dia[ageState], dia[ageState], this);
284+ }
285+ else {
286+ drY -= jump[(int)b.getAge() % 9]/2/jumpLevel[ageState];
287+ g.drawImage(bodyImage[b.getBodyType()][8],drX, drY, dia[ageState], dia[ageState], this);
288+ }
289+ }
290+ else if (b.isStrike()) {
291+ g.drawImage(bodyImage[b.getBodyType()][7],drX, drY, dia[ageState], dia[ageState], this);
292+ }
293+ else if (b.isShitting() || b.isBirth()) {
294+ g.drawImage(bodyImage[b.getBodyType()][1], drX, drY, dia[ageState], dia[ageState], this);
295+ }
296+ else if (b.isFurifuri()) {
297+ if (b.getAge() % 8 <= 3) {
298+ g.drawImage(bodyImage[b.getBodyType()][11], drX, drY, dia[ageState], dia[ageState], this);
299+ }
300+ else if (b.getAge() % 8 <= 7) {
301+ g.drawImage(bodyImage[b.getBodyType()][12], drX, drY, dia[ageState], dia[ageState], this);
302+ }
303+ }
304+ else if (b.isExciting()) {
305+ drY -= jump[(int)b.getAge() % 9]/jumpLevel[ageState];
306+ g.drawImage(bodyImage[b.getBodyType()][2], drX, drY, dia[ageState], dia[ageState], this);
307+ }
308+ else if (b.isSleeping()) {
309+ g.drawImage(bodyImage[b.getBodyType()][3], drX, drY, dia[ageState], dia[ageState], this);
310+ }
311+ else if (b.isPeroPero() || b.isEating()) {
312+ g.drawImage(bodyImage[b.getBodyType()][13], drX, drY, dia[ageState], dia[ageState], this);
313+ }
314+ else if (b.isSukkiri()) {
315+ g.drawImage(bodyImage[b.getBodyType()][14], drX, drY, dia[ageState], dia[ageState], this);
316+ }
317+ else if (b.isDead()) {
318+ g.drawImage(bodyImage[b.getBodyType()][4], drX, drY, dia[ageState], dia[ageState], this);
319+ }
320+ else if (b.isDamaged()) {
321+ g.drawImage(bodyImage[b.getBodyType()][5], drX, drY, dia[ageState], dia[ageState], this);
322+ }
323+ else if (b.isUngry()) {
324+ drY -= jump[(int)b.getAge() % 9]/jumpLevel[ageState];
325+ g.drawImage(bodyImage[b.getBodyType()][6], drX, drY, dia[ageState], dia[ageState], this);
326+ }
327+ else {
328+ drY -= jump[(int)b.getAge() % 9]/2/jumpLevel[ageState];
329+ g.drawImage(bodyImage[b.getBodyType()][0], drX, drY, dia[ageState], dia[ageState], this);
330+ }
331+ // draw script
332+ if (b.getMessage() != null) {
333+ g.setColor(Color.white);
334+ g.fillRoundRect(drX+14, drY-14, b.getMessage().length()*yukkuri.fontWidth()+4, 16, 8, 8);
335+ g.setColor(Color.black);
336+ g.drawRoundRect(drX+14, drY-14, b.getMessage().length()*yukkuri.fontWidth()+4, 16, 8, 8);
337+ g.drawString(b.getMessage(), drX+14+2, drY);
338+ }
339+ }
340+ break;
341+ case Obj.FOOD: {
342+ Food f = (Food)o;
343+ int offsetX = (maxSize - foodSize)/2;
344+ int offsetY = (maxSize - foodSize/2);
345+ int drX = Translate.transX(f.getX(), f.getY(), Box.maxX, Box.maxY)*(w-maxSize)/Box.maxX + offsetX;
346+ int drY = Translate.transY(f.getX(), f.getY(), Box.maxX, Box.maxY)*(h-maxSize)/Box.maxY + offsetY;
347+ if (f.isEmpty()) {
348+ g.drawImage(foodImage[0], drX, drY, foodSize, foodSize/2, this);
349+ }
350+ else {
351+ g.drawImage(foodImage[1], drX, drY, foodSize, foodSize/2, this);
352+ }
353+ }
354+ break;
355+ case Obj.SHIT: {
356+ Shit s = (Shit)o;
357+ int ageState = s.getAgeState();
358+ int dia[] = {10, 20, 30};
359+ int offsetX = (maxSize - dia[ageState])/2;
360+ int offsetY = (maxSize - dia[ageState]);
361+ int drX = Translate.transX(s.getX(), s.getY(), Box.maxX, Box.maxY)*(w-maxSize)/Box.maxX + offsetX;
362+ int drY = Translate.transY(s.getX(), s.getY(), Box.maxX, Box.maxY)*(h-maxSize)/Box.maxY + offsetY;
363+ g.drawImage(shitImage, drX, drY, dia[ageState], dia[ageState], this);
364+ }
365+ break;
366+ }
367+ }
368+ }
369+}
370+
371+class objComparator implements Comparator {
372+ public int compare(Object arg0, Object arg1) {
373+ Obj o1 = (Obj)arg0;
374+ Obj o2 = (Obj)arg1;
375+ if (o1.getY() > o2.getY()) {
376+ return 1;
377+ } else if (o1.getY() < o2.getY()) {
378+ return -1;
379+ } else {
380+ return 0;
381+ }
382+ }
383+}
384+
385+class Translate {
386+ static final private double m = 1.0 / 8.0;
387+ static final private double n = 7.0 / 8.0;
388+
389+ static public int transX(int x, int y, int X, int Y) {
390+ return (int)(((n-m)*Y*x - m*X*y + m*X*Y)/((n-m-1)*y + Y));
391+ }
392+
393+ static public int transY(int x, int y, int X, int Y) {
394+ return (int)(((n-m)*Y*y)/((n-m-1)*y + Y));
395+ }
396+
397+ static public int invX(int x, int y, int X, int Y) {
398+ return (int)((Y*x + m*X*y - m*X*Y)/((n-m)*Y - (n-m-1)*y));
399+ }
400+
401+ static public int invY(int x, int y, int X, int Y) {
402+ return (int)(Y*y/((n-m)*Y - (n-m-1)*y));
403+ }
404+}
\ No newline at end of file
--- tags/1.4/Marisa.java (nonexistent)
+++ tags/1.4/Marisa.java (revision 10)
@@ -0,0 +1,379 @@
1+class Marisa extends Body {
2+ @Override
3+ protected void showWantFood() {
4+ switch (language) {
5+ case JAPANESE:
6+ String messagesJ[] = {"‚²‚Í‚ñ‚µ‚á‚ñ‚Ì‚É‚¨‚¢‚ª‚µ‚ã‚è‚ã‚Ì‚¶‚¥", "‚²‚Í‚ñ‚µ‚á‚ñ‚Ì‚É‚¨‚¢‚ª‚·‚é‚Ì‚¶‚¥", "‚²‚Í‚ñ‚³‚ñ‚Ì‚É‚¨‚¢‚ª‚·‚é‚Ì‚º"};
7+ setMessage(messagesJ[ageState]);
8+ break;
9+ case ENGLISH:
10+ String messagesE[] = {"The shmell of mishder food, je!", "Smelled mishder food, je!", "It's the smell of mister food, ze!"};
11+ setMessage(messagesE[ageState]);
12+ break;
13+ }
14+ }
15+
16+ @Override
17+ public void showNoFood() {
18+ if (toFood == false) {
19+ return;
20+ }
21+ toFood = false;
22+ switch (language) {
23+ case JAPANESE:
24+ String messagesJ[][] = {{"‚²‚Í‚ñ‚µ‚á‚ñ‚É‚á‚¢‚æI", "‚²‚Í‚ñ‚µ‚á‚ñ‚É‚á‚¢‚ɂ傶‚¥H‚΂«‚á‚Ȃ́H‚µ‚É‚ã‚́H", "‚²‚Í‚ñ‚³‚ñ‚È‚¢‚Ì‚ºH‚΂©‚Ȃ́H‚µ‚ʂ́H"},
25+ {"‚²‚Í‚ñ‚µ‚á‚ñ‚©‚¦‚¿‚āAAA", "‚²‚Í‚ñ‚µ‚á‚ñ‚©‚¦‚¿‚āAAA", "‚²‚Í‚ñ‚³‚ñ‚ª‚¦‚À‚Å‚®‚¾‚´‚¢‚¡AAA"}};
26+ setMessage(messagesJ[damageState][ageState]);
27+ break;
28+ case ENGLISH:
29+ String messagesE[][] = {{"Mishder food ish nod here!", "Mishder food ish nod here, je! Are you shtoopid? Wand choo die?", "Mister food is not here, ze? Are you stupid? Want to die?"},
30+ {"Gib back mishder food...", "Gib back mishder food...", "Pwease give back mister food..."}};
31+ setMessage(messagesE[damageState][ageState]);
32+ break;
33+ }
34+ stay();
35+ }
36+
37+ @Override
38+ protected void showExcite() {
39+ if (excitement) {
40+ switch (language) {
41+ case JAPANESE:
42+ setMessage("‚·‚Á‚¬‚肶‚¾‚¢‚Ì‚º`I");
43+ break;
44+ case ENGLISH:
45+ setMessage("Want to refresh, ze~!");
46+ break;
47+ }
48+ }
49+ }
50+
51+ @Override
52+ protected void showRelax() {
53+ if (rnd.nextInt(2) == 0) {
54+ switch (language) {
55+ case JAPANESE:
56+ String messagesJ[] = {"‚Ӂ[‚è‚Ӂ[‚è", "‚Ü‚è‚¿‚á‚Í‚³‚¢‚Á‚«‚傤‚ɂ傶‚¥I", "‚܂肳‚Í‚³‚¢‚Á‚«‚傤‚È‚Ì‚ºI"};
57+ setMessage(messagesJ[ageState], 30);
58+ break;
59+ case ENGLISH:
60+ String messagesE[] = {"Relax-relax~", "Mawisha ish da shdrongest, je!", "Marisa is the strongest, ze!"};
61+ setMessage(messagesE[ageState], 30);
62+ break;
63+ }
64+ furifuri = true;
65+ stay(30);
66+ }
67+ else {
68+ switch (language) {
69+ case JAPANESE:
70+ String messagesJ[] = {"‚ä‚Á‚«‚ã‚肵‚Ä‚¢‚Á‚¿‚¥‚ˁI", "‚ä‚Á‚«‚ã‚肵‚Ä‚¢‚Á‚¿‚¥‚ˁI", "‚ä‚Á‚­‚肵‚Ä‚¢‚Á‚ĂˁI"};
71+ setMessage(messagesJ[ageState]);
72+ break;
73+ case ENGLISH:
74+ String messagesE[] = {"Chake id eajy!", "Chake id eajy!", "Take it easy!"};
75+ setMessage(messagesE[ageState]);
76+ break;
77+ }
78+ stay();
79+ }
80+ }
81+
82+ @Override
83+ protected void showWakeup() {
84+ switch (language) {
85+ case JAPANESE:
86+ String messages[] = {"‚ä‚Á‚«‚ã‚肵‚Ä‚¢‚Á‚¿‚¥‚ˁI", "‚ä‚Á‚«‚ã‚肵‚Ä‚¢‚Á‚¿‚¥‚ˁI", "‚ä‚Á‚­‚肵‚Ä‚¢‚Á‚ĂˁI"};
87+ setMessage(messages[ageState]);
88+ break;
89+ case ENGLISH:
90+ String messagesE[] = {"Chake id eajy!", "Chake id eajy!", "Take it easy!"};
91+ setMessage(messagesE[ageState]);
92+ break;
93+ }
94+ stay();
95+ }
96+
97+ @Override
98+ protected void showSleep() {
99+ if (sleep != 0) {
100+ switch (language) {
101+ case JAPANESE:
102+ setMessage("‚·[‚â‚·[‚â");
103+ break;
104+ case ENGLISH:
105+ setMessage("Sleep-Sleep---");
106+ break;
107+ }
108+ }
109+ }
110+
111+ @Override
112+ protected void showScream() {
113+ messageBuf = null; // show message immediately
114+ switch (language) {
115+ case JAPANESE:
116+ String messagesJ[][] = {{"‚ä‚ñ‚â[I", "‚¢‚¿‚á‚¢I‚Õ‚«‚ã[‚·‚é‚Ì‚¶‚¥I", "‚â‚ß‚é‚ñ‚¾‚ºI‚Õ‚­[‚¾‚ºI"},
117+ {"‚â‚ß‚¿‚¥‚É‚¥‚â‚ß‚¿‚¥‚É‚¥AAA", "‚²‚ß‚ñ‚É‚á‚¿‚á‚¢‚â‚ß‚¿‚¥‚ˁAAA", "‚¨‚Ë‚ª‚¢‚¶‚΂¸A‚â‚ß‚Å‚®‚¾‚´‚¢AAA"}};
118+ setMessage(messagesJ[damageState][ageState]);
119+ break;
120+ case ENGLISH:
121+ String messagesE[][] = {{"YUNYA-!!", "ID HURD! Going choo pyuff-pyuff, je!", "Stop it, ze! Puff, ze!"},
122+ {"Shdop id, shdop id...", "Mawisha ish showwy sho pwease shdop id...", "Pwease, sdop id pwease..."}};
123+ setMessage(messagesE[damageState][ageState]);
124+ break;
125+ }
126+ strike = true;
127+ stay();
128+ }
129+
130+ @Override
131+ protected void showDieing() {
132+ messageBuf = null; // show message immediately
133+ switch (language) {
134+ case JAPANESE:
135+ String messagesJ[] = {"‚ä‚ׂÁI", "‚Õ‚«‚ã‚ÁI", "‚Ô‚Ú‚ÁI"};
136+ setMessage(messagesJ[ageState]);
137+ break;
138+ case ENGLISH:
139+ String messagesE[] = {"Yubee!", "Puff!", "Blarf!"};
140+ setMessage(messagesE[ageState]);
141+ break;
142+ }
143+ stay();
144+ }
145+
146+ @Override
147+ protected void showEating() {
148+ switch (language) {
149+ case JAPANESE:
150+ String messagesJ[][] = {{"‚ށ`‚¿‚á‚ށ`‚¿‚áA‚¿‚ ‚í‚¿‚¥[", "‚ށ[‚¿‚á‚ށ[‚¿‚áA‚¿‚ ‚í‚¿‚¥[", "‚ށ[‚µ‚á‚ށ[‚µ‚áA‚µ‚ ‚킹["},
151+ {"‚Þ‚Á‚¿‚á‚Þ‚Á‚¿‚áAAA", "‚Þ‚¿‚á‚Þ‚¿‚áA‚Í‚Ó‚Í‚Ó", "‚Þ‚Á‚µ‚á‚Þ‚Á‚µ‚áA‚ß‚Á‚¿‚Ⴄ‚ß‚¥"}};
152+ setMessage(messagesJ[hungryState][ageState]);
153+ break;
154+ case ENGLISH:
155+ //Yoga Note* Check ‚Í‚Ó‚Í‚Ó
156+ String messagesE[][] = {{"Myunch-Myunch, happinesh~", "Myunch~ Myunch~ Happinesh~", "Munch munch, Happiness~"},
157+ {"Myunch myunch...", "Myunch Myunch, nom nom", "Munch munch, this shit's good, ze!"}};
158+ setMessage(messagesE[hungryState][ageState]);
159+ break;
160+ }
161+ eating = true;
162+ stay();
163+ }
164+
165+ @Override
166+ protected void showFull() {
167+ switch (language) {
168+ case JAPANESE:
169+ String messagesJ[] = {"‚¨‚É‚á‚©‚¢‚Á‚Ï‚¢AAA", "‚¨‚É‚á‚©‚¢‚Á‚Ï‚¢AAA", "‚à‚¤‚½‚ׂç‚ê‚È‚¢‚Ì‚ºAAA"};
170+ setMessage(messagesJ[ageState]);
171+ break;
172+ case ENGLISH:
173+ String messagesE[] = {"Tummy ish full...", "Tummy ish full...", "Can't eat anymore ze..."};
174+ setMessage(messagesE[ageState]);
175+ break;
176+ }
177+ stay();
178+ }
179+
180+ @Override
181+ protected void showHealing() {
182+ switch (language) {
183+ case JAPANESE:
184+ String messagesJ[][] = {{"‚ ‚Ý‚á‚ ‚Ý‚áI", "‚ä‚Á‚«‚ã‚¿‚µ‚¿‚á‚Ì‚¶‚¥I", "‚ä‚Á‚­‚肵‚½‚Ì‚ºI"},
185+ {"‚ ‚Ý‚á‚ ‚Ý‚á", "‚ä‚Á‚«‚ã‚¿‚µ‚¿‚á‚æ", "‚ä‚Á‚­‚肵‚½‚Ì‚º"}};
186+ setMessage(messagesJ[damageState][ageState]);
187+ break;
188+ case ENGLISH:
189+ String messagesE[][] = {{"Shweet-shweet!", "Weally eajy, je!", "Can take it easy, ze!"},
190+ {"Shweet-shweet", "Can chake id eajy", "Can take it easy, ze."}};
191+ setMessage(messagesE[damageState][ageState]);
192+ break;
193+ }
194+ stay();
195+ }
196+
197+ @Override
198+ protected void showSukkiri() {
199+ switch (language) {
200+ case JAPANESE:
201+ String messagesJ[] = {"‚¿‚ã‚Á‚«‚¿I", "‚¿‚ã‚Á‚«‚èI", "‚·‚Á‚«‚èI"};
202+ setMessage(messagesJ[ageState], 30);
203+ break;
204+ case ENGLISH:
205+ String messagesE[] = {"Wefweshed!", "Wefeshed!", "Refreshed!"};
206+ setMessage(messagesE[ageState], 30);
207+ break;
208+ }
209+ sukkiri = true;
210+ stay(30);
211+ }
212+
213+ @Override
214+ protected void showBirth() {
215+ switch (language) {
216+ case JAPANESE:
217+ setMessage("‚ä‚Á‚­‚¿‚¿‚Ä‚¢‚Á‚¿‚¥‚ˁI", 30);
218+ break;
219+ case ENGLISH:
220+ setMessage("Chake id eajy!", 30);
221+ break;
222+ }
223+ stay(30);
224+ }
225+
226+ @Override
227+ protected void showShit() {
228+ switch (language) {
229+ case JAPANESE:
230+ String messagesJ[] = {"‚¤‚ñ‚¤‚ñ‚À‚¥‚è‚ãI", "‚Ü‚è‚¿‚á‚Ì‚·[‚Ò‚á[‚¤‚ñ‚¤‚ñ‚¿‚á‚¢‚Ý‚ã‚ɂ傶‚¥I", "‚܂肳‚Ì‚·[‚ρ[‚¤‚ñ‚¤‚ñ‚½‚¢‚Þ‚Ì‚ºI"};
231+ setMessage(messagesJ[ageState]);
232+ break;
233+ case ENGLISH:
234+ String messagesE[] = {"Poo-pooing!", "Id'sh Mawisha's shuupa poo-poo time je!!", "It's Marisa's super poo-poo time, ze!"};
235+ setMessage(messagesE[ageState]);
236+ break;
237+ }
238+ }
239+
240+ @Override
241+ protected void showShit2() {
242+ switch (language) {
243+ case JAPANESE:
244+ String messagesJ[] = {"‚·‚Á‚«‚¿I", "‚·‚Á‚«‚¿[I", "‚·‚Á‚«‚è[I"};
245+ setMessage(messagesJ[ageState]);
246+ break;
247+ case ENGLISH:
248+ String messagesE[] = {"Wefeshed!", "Wefeshed-!!", "Refreshed~!"};
249+ setMessage(messagesE[ageState]);
250+ break;
251+ }
252+ furifuri = true;
253+ stay();
254+ }
255+
256+ @Override
257+ protected void showSurisuri() {
258+ switch (language) {
259+ case JAPANESE:
260+ String messagesJ[] = {"‚¿‚ã‚è‚¿‚ã‚è", "‚¿‚ã[‚è‚¿‚ã[‚è", "‚·[‚è‚·[‚è"};
261+ setMessage(messagesJ[ageState]);
262+ break;
263+ case ENGLISH:
264+ String messagesE[] = {"Wub-wub", "Wub-wub", "Rub-rub"};
265+ setMessage(messagesE[ageState]);
266+ break;
267+ }
268+ stay();
269+ }
270+
271+ @Override
272+ protected void showPeroPero() {
273+ switch (language) {
274+ case JAPANESE:
275+ String messagesJ[] = {"‚Ø‚è‚å‚Ø‚è‚å", "‚؁[‚è‚å‚؁[‚è‚å", "‚؁[‚ë‚؁[‚ë"};
276+ setMessage(messagesJ[ageState]);
277+ break;
278+ case ENGLISH:
279+ String messagesE[] = {"Wick-wick~", "Wick-wick~", "Lick-lick~"};
280+ setMessage(messagesE[ageState]);
281+ break;
282+ }
283+ peropero = true;
284+ stay();
285+ }
286+
287+ @Override
288+ protected void showBreed() {
289+ switch (language) {
290+ case JAPANESE:
291+ setMessage("‚¤A‚¤‚΂ê‚éAAA");
292+ break;
293+ case ENGLISH:
294+ setMessage("B...Being born...");
295+ break;
296+ }
297+ }
298+
299+ @Override
300+ protected void showBreed2() {
301+ messageBuf = null;
302+ switch (language) {
303+ case JAPANESE:
304+ setMessage("‚ä‚Á‚­‚肵‚Ä‚¢‚Á‚ĂˁI");
305+ break;
306+ case ENGLISH:
307+ setMessage("Take it easy!");
308+ break;
309+ }
310+ furifuri = true;
311+ stay();
312+ }
313+
314+ @Override
315+ public void showHateShit() {
316+ switch (language) {
317+ case JAPANESE:
318+ String messagesJ[][] = {{"‚­‚¿‚á‚¢I", "‚¤‚ñ‚¤‚ñ‚­‚¿‚á‚¢I‚µ‚ガ‚ã‚É‚©‚½‚¶‚ã‚«‚¥‚è‚åI", "‚¤‚ñ‚¤‚ñ‚©‚½‚¯‚ĂˁI‚·‚®‚Å‚¢‚¢‚æI"},
319+ {"‚­‚¿‚á‚¢AAA", "‚­‚¿‚á‚¢‚æA‚ä‚Á‚«‚ã‚è‚Å‚«‚É‚á‚¢AAA", "‚­‚³‚¢‚æA‚ä‚Á‚­‚è‚Å‚«‚È‚¢‚æAAA"}};
320+ setMessage(messagesJ[damageState][ageState]);
321+ break;
322+ case ENGLISH:
323+ String messagesE[][] = {{"Shmelly~!", "Poo-poo shdinky!! Help eajy!!", "Hurry up and save me from poo-poo!! Right now is fine!"},
324+ {"Shmelly...", "Shmelly, can'ch chake id eajy...", "Smelly... can't take it easy..."}};
325+ setMessage(messagesE[damageState][ageState]);
326+ break;
327+ }
328+ }
329+
330+ @Override
331+ protected void showHungry() {
332+ switch (language) {
333+ case JAPANESE:
334+ String messagesJ[][] = {{"‚ ‚Ý‚á‚ ‚Ý‚á‚¿‚傤‚¶‚á‚¢I", "‚²‚Í‚ñ‚µ‚á‚ñ‚܂肵‚á‚É‚à‚Á‚Ä‚«‚ã‚é‚Ì‚¶‚¥I", "‚²‚Í‚ñ‚³‚ñ‚܂肳‚ɂ悱‚·‚Ì‚ºI‚½‚­‚³‚ñ‚Å‚¢‚¢‚æI"},
335+ {"‚²‚Í‚ñ‚µ‚á‚ñ‚Ç‚«‚åH", "‚¨‚É‚á‚«‚á‚Ö‚Á‚¿‚á‚Ì‚¶‚¥AAA", "‚΂肴‚É‚²‚Í‚ñ‚®‚¾‚´‚¢‚¡"}};
336+ setMessage(messagesJ[damageState][ageState]);
337+ break;
338+ case ENGLISH:
339+ String messagesE[][] = {{"Gib up shweet-shweets!", "Bwing mishder munch-munch choo Mawisha, je!", "Give up the mister munch-munch to Marisa! A lot is fine!"},
340+ {"Where ish mishder food?", "Mishder tummy ish hungwy, je...", "Please give Marisa mister food..."}};
341+ setMessage(messagesE[damageState][ageState]);
342+ break;
343+ }
344+ stay();
345+ }
346+
347+ @Override
348+ protected void showNoAccessory() {
349+ switch (language) {
350+ case JAPANESE:
351+ String messagesJ[] = {"‚ä‚¥[‚ñI‚¨‚Ú‚¤‚µ‚µ‚á‚ñ‚Ç‚«‚åH", "‚ä‚¥[‚ñI‚Ü‚è‚¿‚á‚Ì‚«‚á‚í‚¢‚¢‚¨‚т傤‚µ‚µ‚á‚ñ‚Ç‚«‚å‚É‚á‚Ì‚¶‚¥H", "‚܂肳‚Ì‚¨‚Ú‚¤‚µ‚³‚ñ‚Ç‚±‚È‚Ì‚ºH"};
352+ setMessage(messagesJ[ageState]);
353+ break;
354+ case ENGLISH:
355+ String messagesE[] = {"Yunn~! Where ish misder had?", "Yunn!! Where ish Mawisha's beaudiful mishder had, je?", "Where is Marisa's mister hat, ze?"};
356+ setMessage(messagesE[ageState]);
357+ break;
358+ }
359+ }
360+
361+ @Override
362+ public void showHateYukkuri() {
363+ switch (language) {
364+ case JAPANESE:
365+ String messagesJ[] = {"‚ä‚Á‚­‚¿‚Å‚«‚É‚á‚¢‚ä‚Á‚­‚¿‚ª‚¢‚è‚ã‚æ", "‚ä‚Á‚­‚¿‚Å‚«‚É‚á‚¢‚ä‚Á‚­‚¿‚ª‚¢‚è‚ã‚Ì‚¶‚¥", "‚ä‚Á‚­‚è‚Å‚«‚È‚¢‚ä‚Á‚­‚肪‚¢‚é‚Ì‚ºI‚¹‚¢‚Á‚³‚¢‚·‚é‚Ì‚ºI"};
366+ setMessage(messagesJ[ageState]);
367+ break;
368+ case ENGLISH:
369+ String messagesE[] = {"There'sh a yukkuri that can'ch chake id eajy", "A yukkuri that can'ch chake id eajy, je", "A yukkuri that can't take it easy, ze! Punishment time, ze!"};
370+ setMessage(messagesE[ageState]);
371+ break;
372+ }
373+ }
374+
375+ // public methods
376+ public Marisa(int initX, int initY, int initAgeState) {
377+ super(initX, initY, Body.MARISA, initAgeState);
378+ }
379+}
\ No newline at end of file
--- tags/1.4/Body.java (nonexistent)
+++ tags/1.4/Body.java (revision 10)
@@ -0,0 +1,934 @@
1+import java.util.Random;
2+
3+public class Body extends Obj {
4+ // public variables
5+ public static final int MARISA = 1;
6+ public static final int REIMU = 2;
7+ public static final int EATAMOUNT[] = {100*4, 100*6, 100*8};
8+ public static final int BABY = 0;
9+ public static final int CHILD = 1;
10+ public static final int ADULT = 2;
11+
12+ // private variables
13+ private static final int HUNGRYLIMIT[] = {100*24, 100*24*3, 100*24*7};
14+ private static final int SHITLIMIT[] = {100*8, 100*12, 100*24};
15+ private static final int DAMAGELIMIT[] = {100*24, 100*24*3, 100*24*7};
16+ private static final int BABYLIMIT = 100*24*2;
17+ private static final int CHILDLIMIT = 100*24*7;
18+ private static final int LIFELIMIT = 100*24*365*5;
19+ private static final int HUNGRYNOT = 0;
20+ private static final int HUNGRYMUCH = 1;
21+ private static final int DAMAGENOT = 0;
22+ private static final int DAMAGEMUCH = 1;
23+ private static final int STEP[] = {1, 2, 4};
24+ private static final int RELAXPERIOD = 100*1;
25+ private static final int EXCITEPERIOD = 100*3;
26+ private static final int PREGPERIOD = 100*24;
27+ private static final int SLEEPPERIOD = 100*3;
28+ private static final int ACTIVEPERIOD = 100*6;
29+ private static final int NEEDLE = 100;
30+ private static final int HAMMER = 100*24;
31+ private static final int HOLDMESSAGE = 15;
32+ private static final int STAYLIMIT = 15;
33+
34+ protected static final int JAPANESE = 0;
35+ protected static final int ENGLISH = 1;
36+
37+ private int yukkuriType;
38+
39+ protected int ageState; //BABY, CHILD, ADULT
40+ protected String messageBuf;
41+ protected int dextX = -1, destY = -1; //destination
42+ protected int damage = 0; //counter indicating damage
43+ protected int damageState = DAMAGENOT;
44+ protected int hungry = 0; //counter indicating how hungry
45+ protected int hungryState = HUNGRYNOT;
46+ protected int shit = 0;
47+ protected int noDamagePeriod = 0;
48+ protected int noHungryPeriod = 0;
49+ protected boolean hasAccessory = true; //true if having accessory
50+ protected boolean hasBaby = false; //having baby or not
51+ protected int babyType;
52+ protected int pregnant = 0;
53+ protected boolean dead = false; // dead of alive
54+ protected boolean excitement = false; //
55+ protected int excite = 0;
56+ protected boolean relax = false;
57+ protected boolean sleeping = false;
58+ protected int sleep = 0;
59+ protected long wakeUpTime;
60+ protected Random rnd = new Random();
61+ protected int countX = 0, countY = 0; // how many steps to same direction
62+ protected int dirX = 0, dirY = 0; // direction to move on
63+ protected int messageCount = 0;
64+ protected boolean staying = false;
65+ protected int staycount = 0;
66+ protected int stayTime = STAYLIMIT;
67+ protected boolean toFood = false;
68+ protected boolean toSukkiri = false;
69+ protected boolean shitting = false;
70+ protected boolean birth = false;
71+ protected boolean ungry = false;
72+ protected boolean furifuri = false;
73+ protected boolean strike = false;
74+ protected boolean eating = false;
75+ protected boolean peropero = false;
76+ protected boolean sukkiri = false;
77+ protected int language = JAPANESE;
78+
79+ // private methods
80+ private int checkAageState() {
81+ int state;
82+ if (age < BABYLIMIT) {
83+ state = BABY;
84+ } else if (age < CHILDLIMIT) {
85+ state = CHILD;
86+ } else {
87+ state = ADULT;
88+ }
89+ return state;
90+ }
91+
92+ private int checkHungryState() {
93+ int state;
94+ if (hungry < HUNGRYLIMIT[ageState]/4) {
95+ state = HUNGRYNOT;
96+ } else {
97+ state = HUNGRYMUCH;
98+ }
99+ return state;
100+ }
101+
102+ private int checkDamageState() {
103+ int state;
104+ if (damage < DAMAGELIMIT[ageState]/2) {
105+ state = DAMAGENOT;
106+ } else {
107+ state = DAMAGEMUCH;
108+ }
109+ return state;
110+ }
111+
112+ private void checkHungry() {
113+ if (excitement == true || hasBaby == true) {
114+ hungry += TICK*2;
115+ } else {
116+ hungry += TICK;
117+ }
118+ if (hungry > HUNGRYLIMIT[ageState]) {
119+ dead = true;
120+ }
121+ if (hungryState == HUNGRYNOT && checkHungryState() == HUNGRYNOT) {
122+ noHungryPeriod += TICK;
123+ } else {
124+ noHungryPeriod = 0;
125+ }
126+ hungryState = checkHungryState();
127+ }
128+
129+ private void checkDamage() {
130+ if (hungryState == HUNGRYNOT) {
131+ damage -= TICK;
132+ }
133+ if (damage < 0) {
134+ damage = 0;
135+ } else if (damage > DAMAGELIMIT[ageState]) {
136+ dead = true;
137+ }
138+ if (damageState == DAMAGENOT && checkDamageState() == DAMAGENOT) {
139+ noDamagePeriod += TICK;
140+ } else {
141+ noDamagePeriod = 0;
142+ }
143+ damageState = checkDamageState();
144+ }
145+
146+ private boolean checkShit() {
147+ boolean cantMove = false;
148+ if (hungryState == HUNGRYNOT) {
149+ shit += TICK*2;
150+ } else {
151+ shit += TICK;
152+ }
153+ if (shit > SHITLIMIT[ageState] - TICK*100) {
154+ cantMove = true;
155+ shitting = true;
156+ showShit();
157+ }
158+ if (shit > SHITLIMIT[ageState]) {
159+ shitting = false;
160+ shit = 0;
161+ showShit2();
162+ }
163+ return cantMove;
164+ }
165+
166+ private boolean checkPregnant() {
167+ boolean cantMove = false;
168+ if (hasBaby) {
169+ pregnant += TICK;
170+ if (pregnant > PREGPERIOD - TICK*100) {
171+ cantMove = true;
172+ birth = true;
173+ showBreed();
174+ }
175+ if (pregnant > PREGPERIOD) {
176+ // Keep babyType for generating baby.
177+ pregnant = 0;
178+ birth = false;
179+ hasBaby = false;
180+ showBreed2();
181+ }
182+ }
183+ return cantMove;
184+ }
185+
186+ private boolean checkSleep() {
187+ if (wakeUpTime + ACTIVEPERIOD < age && excitement == false && relax == true) {
188+ toFood = false;
189+ sleeping = true;
190+ ungry = false;
191+ sleep += TICK;
192+ if (sleep > SLEEPPERIOD) {
193+ showWakeup();
194+ wakeup();
195+ }
196+ } else {
197+ sleep = 0;
198+ sleeping = false;
199+ }
200+ return sleeping;
201+ }
202+
203+ private void wakeup() {
204+ sleep = 0;
205+ sleeping = false;
206+ wakeUpTime = age;
207+ }
208+
209+ private void checkExciteAndRelax() {
210+ if (noHungryPeriod > RELAXPERIOD && noDamagePeriod > RELAXPERIOD && !sleeping && hasAccessory) {
211+ if (excitement == false && relax == false) {
212+ int r = rnd.nextInt(24);
213+ if (ageState == ADULT && hasBaby == false && r == 0) {
214+ excitement = true;
215+ relax = false;
216+ showExcite();
217+ }
218+ else {
219+ excitement = false;
220+ relax = true;
221+ ungry = false;
222+ showRelax();
223+ }
224+ } else {
225+ excite += TICK;
226+ if (excite > EXCITEPERIOD) {
227+ excite = 0;
228+ excitement = false;
229+ relax = false;
230+ }
231+ }
232+ }
233+ if (hungryState != HUNGRYNOT || damageState != DAMAGENOT || !hasAccessory) {
234+ relax = false;
235+ wakeup();
236+ }
237+ }
238+
239+ private void checkMessage() {
240+ if (--messageCount <= 0) {
241+ messageCount = 0;
242+ messageBuf = null;
243+ furifuri = false;
244+ strike = false;
245+ eating = false;
246+ peropero = false;
247+ sukkiri = false;
248+ }
249+ if (dead) {
250+ //String messages[] = {"‚à‚Á‚¿‚å‚ä‚Á‚­‚¿‚µ‚¿‚á‚©‚Á‚½AAA", "‚à‚Á‚¿‚å‚ä‚Á‚­‚¿‚µ‚¿‚á‚©‚Á‚½AAA", "‚à‚Á‚Æ‚ä‚Á‚­‚肵‚½‚©‚Á‚½AAA"};
251+ String messages[] = {"Wanted choo chake id eajy more...", "Wanted choo chake id eajy more...", "Wanted to take it easy more..."};
252+ setMessage(messages[ageState]);
253+ } else if (messageBuf == null) {
254+ if (toFood) {
255+ showWantFood();
256+ }
257+ else if (toSukkiri) {
258+ showExcite();
259+ }
260+ else if (sleeping) {
261+ if (rnd.nextInt(10) == 0) {
262+ showSleep();
263+ }
264+ }
265+ else if (!hasAccessory) {
266+ showNoAccessory();
267+ }
268+ else if (isHungry()) {
269+ if (rnd.nextInt(15) == 0) {
270+ showHungry();
271+ }
272+ }
273+ }
274+ }
275+
276+ protected void stay() {
277+ staying = true;
278+ stayTime = STAYLIMIT;
279+ }
280+
281+ protected void stay(int time) {
282+ staying = true;
283+ stayTime = time;
284+ }
285+
286+ private void moveBody() {
287+ int sameDest = 30 * STEP[ageState];
288+ int step;
289+ if (hasBaby || hungryState == HUNGRYMUCH || damageState == DAMAGEMUCH) {
290+ step = STEP[ageState]/2;
291+ } else {
292+ step = STEP[ageState];
293+ }
294+ if (step == 0) {
295+ step = 1;
296+ }
297+ int freq = STEP[ADULT]/step;
298+ if (age % freq != 0) {
299+ return;
300+ }
301+ step = 1;
302+ // calculate x axis
303+ if (dextX >= 0) {
304+ if (dextX - x > step) {
305+ x += step;
306+ } else if (x - dextX > step) {
307+ x -= step;
308+ } else {
309+ dextX = -1;
310+ }
311+ } else {
312+ if (countX++ == 0) {
313+ int r = rnd.nextInt(2);
314+ switch (dirX) {
315+ case 0: {
316+ if (r == 0) {
317+ dirX = 1;
318+ } else {
319+ dirX = -1;
320+ }
321+ break;
322+ }
323+ case 1: {
324+ if (r == 0) {
325+ dirX = 0;
326+ }
327+ break;
328+ }
329+ case -1: {
330+ if (r == 0) {
331+ dirX = 0;
332+ }
333+ break;
334+ }
335+ default:
336+ break;
337+ }
338+ } else {
339+ if (countX++ >= sameDest) {
340+ countX = 0;
341+ }
342+ }
343+ x += dirX * step;
344+ }
345+ if (x < 0) {
346+ x = 0;
347+ dirX *= -1;
348+ } else if (x > Box.maxX) {
349+ x = Box.maxX;
350+ dirX *= -1;
351+ }
352+ // calculate y axis
353+ if (destY >= 0) {
354+ if (destY - y > step) {
355+ y += step;
356+ } else if (y - destY > step) {
357+ y -= step;
358+ } else {
359+ destY = -1;
360+ }
361+ } else {
362+ if (countY++ == 0) {
363+ int r = rnd.nextInt(2);
364+ switch (dirY) {
365+ case 0: {
366+ if (r == 0) {
367+ dirY = 1;
368+ } else {
369+ dirY = -1;
370+ }
371+ break;
372+ }
373+ case 1: {
374+ if (r == 0) {
375+ dirY = 0;
376+ }
377+ break;
378+ }
379+ case -1: {
380+ if (r == 0) {
381+ dirY = 0;
382+ }
383+ break;
384+ }
385+ default:
386+ break;
387+ }
388+ } else {
389+ if (countY++ >= sameDest) {
390+ countY = 0;
391+ }
392+ }
393+ y += dirY * step;
394+ }
395+ if (y < 0) {
396+ y = 0;
397+ dirY *= -1;
398+ } else if (y > Box.maxY) {
399+ y = Box.maxY;
400+ dirY *= -1;
401+ }
402+ }
403+
404+ protected void setMessage(String message) {
405+ if (staying == true && messageBuf != null) {
406+ return;
407+ }
408+ messageCount = HOLDMESSAGE;
409+ messageBuf = message;
410+ }
411+ protected void setMessage(String message, int count) {
412+ if (staying == true && messageBuf != null) {
413+ return;
414+ }
415+ messageCount = count;
416+ messageBuf = message;
417+ }
418+
419+ protected void showWantFood() {
420+ System.out.println("Uknown type");
421+ }
422+
423+ public void showNoFood() {
424+ if (toFood == false) {
425+ return;
426+ }
427+ toFood = false;
428+ System.out.println("Uknown type");
429+ stay();
430+ }
431+
432+ protected void showExcite() {
433+ if (excitement) {
434+ System.out.println("Uknown type");
435+ }
436+ }
437+
438+ protected void showRelax() {
439+ System.out.println("Uknown type");
440+ stay();
441+ }
442+
443+ protected void showWakeup() {
444+ System.out.println("Uknown type");
445+ stay();
446+ }
447+
448+ protected void showSleep() {
449+ if (sleep != 0) {
450+ System.out.println("Uknown type");
451+ }
452+ }
453+
454+ protected void showScream() {
455+ staying = false;
456+ strike = true;
457+ System.out.println("Uknown type");
458+ stay();
459+ }
460+
461+ protected void showDieing() {
462+ staying = false;
463+ System.out.println("Uknown type");
464+ stay();
465+ }
466+
467+ protected void showEating() {
468+ eating = true;
469+ System.out.println("Uknown type");
470+ stay();
471+ }
472+
473+ protected void showFull() {
474+ System.out.println("Uknown type");
475+ stay();
476+ }
477+
478+ protected void showHealing() {
479+ System.out.println("Uknown type");
480+ stay();
481+ }
482+
483+ protected void showSukkiri() {
484+ System.out.println("Uknown type");
485+ sukkiri = true;
486+ stay(30);
487+ }
488+
489+ protected void showBirth() {
490+ System.out.println("Uknown type");
491+ stay(30);
492+ }
493+
494+ protected void showShit() {
495+ System.out.println("Uknown type");
496+ }
497+
498+ protected void showShit2() {
499+ System.out.println("Uknown type");
500+ furifuri = true;
501+ stay();
502+ }
503+
504+ protected void showSurisuri() {
505+ System.out.println("Uknown type");
506+ stay();
507+ }
508+
509+ protected void showPeroPero() {
510+ peropero = true;
511+ System.out.println("Uknown type");
512+ stay();
513+ }
514+
515+ protected void showBreed() {
516+ System.out.println("Uknown type");
517+ }
518+
519+ protected void showBreed2() {
520+ messageBuf = null;
521+ System.out.println("Uknown type");
522+ furifuri = true;
523+ stay();
524+ }
525+
526+ public void showHateShit() {
527+ System.out.println("Uknown type");
528+ }
529+
530+ protected void showHungry() {
531+ System.out.println("Uknown type");
532+ stay();
533+ }
534+
535+ protected void showNoAccessory() {
536+ System.out.println("Uknown type");
537+ }
538+
539+ public void showHateYukkuri() {
540+ System.out.println("Uknown type");
541+ }
542+
543+ // public methods
544+ public Body(int initX, int initY, int initType, int initAgeState) {
545+ objType = YUKKURI;
546+ x = initX;
547+ y = initY;
548+ z = 0;
549+ yukkuriType = initType;
550+ switch (initAgeState) {
551+ case BABY:
552+ age = 0;
553+ showBirth();
554+ break;
555+ case CHILD:
556+ age = BABYLIMIT;
557+ break;
558+ case ADULT:
559+ default:
560+ age = CHILDLIMIT;
561+ break;
562+ }
563+ age += rnd.nextInt(100);
564+ ageState = checkAageState();
565+ shit = rnd.nextInt(SHITLIMIT[ageState]);
566+ wakeUpTime = age;
567+ removed = false;
568+ }
569+
570+ public int getBodyType() {
571+ return yukkuriType;
572+ }
573+
574+ public int getBabyType() {
575+ return babyType;
576+ }
577+
578+ public int getAgeState() {
579+ return ageState;
580+ }
581+
582+ public long getAge() {
583+ return age;
584+ }
585+
586+ public int getEatAmount() {
587+ return EATAMOUNT[ageState];
588+ }
589+
590+ public int getStep() {
591+ return STEP[ageState];
592+ }
593+
594+ public String getMessage() {
595+ return messageBuf;
596+ }
597+
598+ public boolean isDead() {
599+ return dead;
600+ }
601+
602+ public boolean isAdult() {
603+ if (ageState == ADULT) {
604+ return true;
605+ }
606+ else {
607+ return false;
608+ }
609+ }
610+
611+ public boolean isSleeping() {
612+ if (dead) {
613+ return false;
614+ }
615+ return sleeping;
616+ }
617+
618+ public boolean isHungry() {
619+ if (dead) {
620+ return false;
621+ }
622+ if (hungry >= HUNGRYLIMIT[ageState]/8) {
623+ return true;
624+ }
625+ return false;
626+ }
627+
628+ public boolean isShitting() {
629+ if (dead) {
630+ return false;
631+ }
632+ return(shitting);
633+ }
634+
635+ public boolean isExciting() {
636+ if (dead) {
637+ return false;
638+ }
639+ return(excitement);
640+ }
641+
642+ public boolean isUngry() {
643+ if (dead) {
644+ return false;
645+ }
646+ return (ungry);
647+ }
648+
649+ public boolean isFurifuri() {
650+ if (dead) {
651+ return false;
652+ }
653+ return (furifuri);
654+ }
655+
656+ public boolean isStrike() {
657+ if (dead) {
658+ return false;
659+ }
660+ return strike;
661+ }
662+
663+ public boolean isDamaged() {
664+ if (checkDamageState() == DAMAGEMUCH) {
665+ return true;
666+ }
667+ return false;
668+ }
669+
670+ public boolean isBirth() {
671+ if (dead) {
672+ return false;
673+ }
674+ if (birth) {
675+ return true;
676+ }
677+ return false;
678+ }
679+
680+ public boolean isAccessory() {
681+ return hasAccessory;
682+ }
683+
684+ public boolean isEating() {
685+ if (dead) {
686+ return false;
687+ }
688+ return eating;
689+ }
690+
691+ public boolean isPeroPero() {
692+ if (dead) {
693+ return false;
694+ }
695+ return peropero;
696+ }
697+
698+ public boolean isSukkiri() {
699+ if (dead) {
700+ return false;
701+ }
702+ return sukkiri;
703+ }
704+
705+ public void doSukkiri(Body partner) {
706+ if (dead) {
707+ return;
708+ }
709+ toSukkiri = false;
710+ // show message
711+ showSukkiri();
712+ partner.showSukkiri();
713+ // change state
714+ excitement = false;
715+ relax = false;
716+ ungry = false;
717+ noHungryPeriod = 0;
718+ hungry += 100*12;
719+ hungryState = checkHungryState();
720+ //change partner state
721+ partner.hasBaby = true;
722+ if (yukkuriType == partner.yukkuriType) {
723+ partner.babyType = yukkuriType;
724+ } else if (rnd.nextInt(2) == 0) {
725+ partner.babyType = yukkuriType;
726+ } else {
727+ partner.babyType = partner.yukkuriType;
728+ }
729+ partner.excitement = false;
730+ partner.relax = false;
731+ partner.ungry = false;
732+ partner.noHungryPeriod = 0;
733+ partner.hungry += 100*24;
734+ partner.hungryState = partner.checkHungryState();
735+ }
736+
737+ public void forceSukkiri() {
738+ if (dead || !hasAccessory) {
739+ return;
740+ }
741+ if (hasBaby == false) {
742+ excitement = true;
743+ showExcite();
744+ }
745+ stay();
746+ }
747+
748+ public void doSurisuri(Body partner) {
749+ if (dead) {
750+ return;
751+ }
752+ if (ageState == ADULT && partner.ageState != ADULT) {
753+ showPeroPero();
754+ }
755+ else {
756+ showSurisuri();
757+ }
758+ ungry = false;
759+ partner.ungry = false;
760+ //partner.stay();
761+ }
762+
763+ public void moveTo(int toX, int toY) {
764+ if (dead) {
765+ return;
766+ }
767+ dextX = toX;
768+ destY = toY;
769+ }
770+
771+ public void moveToFood(int toX, int toY) {
772+ toFood = true;
773+ toSukkiri = false;
774+ moveTo(toX, toY);
775+ }
776+
777+ public void moveToSukkiri(int toX, int toY) {
778+ toSukkiri = true;
779+ toFood = false;
780+ moveTo(toX, toY);
781+ }
782+
783+ public void eatFood(int amount) {
784+ if (dead) {
785+ return;
786+ }
787+ toFood = false;
788+ if (!isHungry()) {
789+ showFull();
790+ return;
791+ }
792+ hungry -= amount;
793+ if (hungry < 0) {
794+ hungry = 0;
795+ }
796+ showEating();
797+ hungryState = checkHungryState();
798+ ungry = false;
799+ }
800+
801+ public void strike(int amount) {
802+ if (dead) {
803+ return;
804+ }
805+ damage += amount;
806+ showScream();
807+ damageState = checkDamageState();
808+ if (damageState == DAMAGENOT && hasAccessory) {
809+ ungry = true;
810+ }
811+ else {
812+ ungry = false;
813+ }
814+ wakeup();
815+ }
816+
817+ public void strikeByNeedle() {
818+ strike(NEEDLE);
819+ }
820+
821+ public void strikeByHammer() {
822+ if (dead) {
823+ return;
824+ }
825+ strike(HAMMER);
826+ if (damage > DAMAGELIMIT[ageState]) {
827+ showDieing();
828+ }
829+ }
830+
831+ public void takeAccessory() {
832+ hasAccessory = false;
833+ }
834+
835+ public void giveAccessory() {
836+ hasAccessory = true;
837+ }
838+
839+ public void giveJuice(){
840+ if (dead) {
841+ return;
842+ }
843+ damage -= 100*100;
844+ if (damage < 0) {
845+ damage = 0;
846+ }
847+ showHealing();
848+ damageState = checkDamageState();
849+ ungry = false;
850+ }
851+
852+ public void setLanguage(int lang) {
853+ language = lang;
854+ }
855+
856+ // calling every tick
857+ public int clockTick() {
858+ int retval = DONOTHING;
859+
860+ // if removed, remove body
861+ if (removed) {
862+ return REMOVED;
863+ }
864+
865+ // if dead, do nothing.
866+ if (dead) {
867+ checkMessage();
868+ return DEAD;
869+ }
870+
871+ // check age
872+ age += TICK;
873+ if (age > LIFELIMIT) {
874+ dead = true;
875+ }
876+ ageState = checkAageState();
877+
878+ // check hungry
879+ checkHungry();
880+
881+ // check damage
882+ checkDamage();
883+
884+ // check events
885+ boolean dontMove = false;
886+
887+ // check shit
888+ int oldShit = shit;
889+ if (checkShit()) {
890+ dontMove = true;
891+ }
892+ if (oldShit != 0 && shit == 0) {
893+ retval = DOSHIT;
894+ }
895+
896+ // check pregnant
897+ boolean oldHasBaby = hasBaby;
898+ if (checkPregnant()) {
899+ dontMove = true;
900+ }
901+ if (oldHasBaby == true && hasBaby == false) {
902+ retval = BIRTHBABY;
903+ }
904+
905+ // check sleep
906+ if (checkSleep()) {
907+ dontMove = true;
908+ }
909+
910+ // check relax and excitement
911+ checkExciteAndRelax();
912+
913+ if (staying) {
914+ staycount += TICK;
915+ if (staycount > stayTime) {
916+ staycount = 0;
917+ staying = false;
918+ } else {
919+ dontMove = true;
920+ }
921+ }
922+
923+ // move to destination
924+ // if there is no destination, walking randomly.
925+ if (dontMove == false) {
926+ moveBody();
927+ }
928+
929+ //
930+ checkMessage();
931+
932+ return retval;
933+ }
934+}
--- tags/1.4/Food.java (nonexistent)
+++ tags/1.4/Food.java (revision 10)
@@ -0,0 +1,50 @@
1+public class Food extends Obj {
2+ public static final int YUKKURIFOOD = 1;
3+ public static final int CAKE = 2;
4+
5+ private int foodType;
6+ private int amount;
7+
8+ public Food(int initX, int initY, int initType) {
9+ objType = FOOD;
10+ x = initX;
11+ y = initY;
12+ z = 0;
13+ foodType = initType;
14+ switch (initType) {
15+ case YUKKURIFOOD:
16+ amount = 60*60*2;
17+ break;
18+ case CAKE:
19+ amount = 60*60;
20+ break;
21+ default:
22+ amount = 60*60;
23+ }
24+ removed = false;
25+ }
26+
27+ public boolean isEmpty() {
28+ if (amount == 0) {
29+ return true;
30+ }
31+ return false;
32+ }
33+
34+ public void eatFood(int eatAmount) {
35+ if (isEmpty()) {
36+ return;
37+ }
38+ amount -= eatAmount;
39+ if (amount < 0) {
40+ amount = 0;
41+ }
42+ }
43+
44+ public int clockTick() {
45+ if (removed == false) {
46+ return DONOTHING;
47+ }
48+ return REMOVED;
49+ }
50+}
\ No newline at end of file
--- tags/1.4/Box.java (nonexistent)
+++ tags/1.4/Box.java (revision 10)
@@ -0,0 +1,5 @@
1+public class Box {
2+ public static final int maxX = 300;
3+ public static final int maxY = 300;
4+ public static final int maxZ = 100;
5+}
Show on old repository browser