munch
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

34 行
615 B

  1. function Creature(name = "Creature") {
  2. this.name = name;
  3. this.health = 100;
  4. this.maxHealth = 100;
  5. this.mass = 80;
  6. this.stomach = Stomach();
  7. }
  8. function Player(name = "Player") {
  9. Creature.call(this, name);
  10. this.fullness = 100;
  11. this.maxFullness = 200;
  12. }
  13. function Container(name = "stomach") {
  14. this.name = name;
  15. this.contents = [];
  16. this.digest = function() {
  17. };
  18. }
  19. function Stomach() {
  20. Container.call(this, "stomach");
  21. this.digest = function() {
  22. let lines = [];
  23. this.contents.forEach(function (prey) {
  24. lines.push("Something is digesting!");
  25. });
  26. return lines;
  27. }
  28. }