Skip to content

Instantly share code, notes, and snippets.

@seeya
Created December 28, 2019 03:59
Show Gist options
  • Save seeya/709425b4bb44f3670be59732f2825d9a to your computer and use it in GitHub Desktop.
Save seeya/709425b4bb44f3670be59732f2825d9a to your computer and use it in GitHub Desktop.
A snippet of Animal Restaurant source code
isFishCollision: function() {
return this.fishCollision;
},
isWasScared: function() {
if (this.forceScared) {
var e = s.default[this.fishType].fishScared;
this.rate = e.rate;
return !0;
}
if (this.scaredCollision) {
var t = s.default[this.fishType].fishScared, i = t.pro, n = f(100, 0);
this.wasScared = n <= i;
if (this.wasScared) {
this.rate = t.rate;
return !0;
}
}
return !1;
},
isWasHurt: function() {
return this.state === l.WasHurt;
},
isMiss: function() {
return this.isWasHurt() && this.missed;
},
isIdle: function() {
return this.state === l.Idle;
},
isFloat: function() {
var e = s.default[this.fishType].float.pro;
return f(100, 0) <= e;
},
isSwim: function() {
var e = s.default[this.fishType].swim.pro, t = f(100, 0);
this.swiming = t <= e;
return this.swiming;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment